Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Passing the files as an argument in Subroutines

by 2teez (Vicar)
on Jul 20, 2015 at 02:40 UTC ( #1135400=note: print w/replies, xml ) Need Help??


in reply to Re^2: Passing the files as an argument in Subroutines
in thread Passing the files as an argument in Subroutines

Hi shroh,

Hi James, This is what i am getting when i use when using strict and warning....E:\Temp\inyrohs>perl outage_nodes.pl off Can't locate warning.pm..

perl does not have use warning but warnings. Note the s. After that is corrected, then try running the code again.
You can also include use diagnostics; so the pragmas will go like thus:

use strict; use warnings; use diagnostics;

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Replies are listed 'Best First'.
Re^4: Passing the files as an argument in Subroutines
by shroh (Acolyte) on Jul 20, 2015 at 02:54 UTC
    E:\Temp\inyrohs>perl outage_nodes.pl on Possible unintended interpolation of @outagenodes in string at outage_ +nodes.pl l ine 52. Variable "$LOG" is not imported at outage_nodes.pl line 63. Bareword found where operator expected at outage_nodes.pl line 120, ne +ar ""ovdep loy -cmd "ovc" Global symbol "$SEC" requires explicit package name at outage_nodes.pl + line 19. Global symbol "$MIN" requires explicit package name at outage_nodes.pl + line 19. Global symbol "$HOUR" requires explicit package name at outage_nodes.p +l line 19. Global symbol "$DAY" requires explicit package name at outage_nodes.pl + line 19. Global symbol "$MON" requires explicit package name at outage_nodes.pl + line 19. Global symbol "$YEAR" requires explicit package name at outage_nodes.p +l line 19. Global symbol "$year" requires explicit package name at outage_nodes.p +l line 21. Global symbol "$YEAR" requires explicit package name at outage_nodes.p +l line 21. Global symbol "$month" requires explicit package name at outage_nodes. +pl line 22 . Global symbol "$MON" requires explicit package name at outage_nodes.pl + line 22. Global symbol "$day" requires explicit package name at outage_nodes.pl + line 23. Global symbol "$DAY" requires explicit package name at outage_nodes.pl + line 23. Global symbol "$date" requires explicit package name at outage_nodes.p +l line 24. Global symbol "$year" requires explicit package name at outage_nodes.p +l line 24. Global symbol "$month" requires explicit package name at outage_nodes. +pl line 24 . Global symbol "$day" requires explicit package name at outage_nodes.pl + line 24. Global symbol "$LOG" requires explicit package name at outage_nodes.pl + line 26. Global symbol "$date" requires explicit package name at outage_nodes.p +l line 26. Global symbol "$tempfile" requires explicit package name at outage_nod +es.pl line 28. Global symbol "$serverlist" requires explicit package name at outage_n +odes.pl li ne 30. Global symbol "@outagenodes" requires explicit package name at outage_ +nodes.pl l ine 37. Global symbol "@tempnodes" requires explicit package name at outage_no +des.pl lin e 46. Global symbol "@outagenodes" requires explicit package name at outage_ +nodes.pl l ine 52. Global symbol "$LOG" requires explicit package name at outage_nodes.pl + line 63. Global symbol "$LOG" requires explicit package name at outage_nodes.pl + line 63. Global symbol "$maintMode" requires explicit package name at outage_no +des.pl lin e 65. Global symbol "$HOUR" requires explicit package name at outage_nodes.p +l line 65. Global symbol "$MIN" requires explicit package name at outage_nodes.pl + line 65. Global symbol "$SEC" requires explicit package name at outage_nodes.pl + line 65. Global symbol "$date" requires explicit package name at outage_nodes.p +l line 67. Global symbol "$maintMode" requires explicit package name at outage_no +des.pl lin e 72. Global symbol "$maintmode" requires explicit package name at outage_no +des.pl lin e 75. Global symbol "$maintMode" requires explicit package name at outage_no +des.pl lin e 77. Global symbol "$NODES" requires explicit package name at outage_nodes. +pl line 80 . Global symbol "@outagenodes" requires explicit package name at outage_ +nodes.pl l ine 80. Global symbol "$NODES" requires explicit package name at outage_nodes. +pl line 87 . Global symbol "$maintMode" requires explicit package name at outage_no +des.pl lin e 91. Global symbol "$cmd" requires explicit package name at outage_nodes.pl + line 99. Global symbol "$NODES" requires explicit package name at outage_nodes. +pl line 99 . Global symbol "$maintMode" requires explicit package name at outage_no +des.pl lin e 99. Global symbol "$cmd" requires explicit package name at outage_nodes.pl + line 101. Global symbol "$cmd" requires explicit package name at outage_nodes.pl + line 103. Global symbol "$maintMode" requires explicit package name at outage_no +des.pl lin e 111. Global symbol "$NODES" requires explicit package name at outage_nodes. +pl line 11 6. Global symbol "$cmd" requires explicit package name at outage_nodes.pl + line 118. Global symbol "$NODES" requires explicit package name at outage_nodes. +pl line 11 8. Global symbol "$maintMode" requires explicit package name at outage_no +des.pl lin e 118. Global symbol "$cmdstopopcmona" requires explicit package name at outa +ge_nodes.p l line 120. outage_nodes.pl has too many errors.

      Beautiful!. This shows that you are making good progress.
      Now, use my to make all your variable local to your program file. i.e like so:

      my ($SEC,$MIN,$HOUR, $DAY, $MON, $YEAR) = ...; ... my $LOG = ...

      You probably want to do perldoc -f my and perldoc strict on your CLI, to read a quick tip.

      If you tell me, I'll forget.
      If you show me, I'll remember.
      if you involve me, I'll understand.
      --- Author unknown to me

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1135400]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2021-04-10 22:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?