perl arguments
OK I'm a newbie at perl. whats wrong with the perl below??? I keep getting errors
Global symbol "$hostfile" requires explicit package name at ./multi-rtr-cmd.pl line 14. Global symbol "$outputfile" requires explicit package name at ./multi-rtr-cmd.pl line 16. Global symbol "$command1" requires explicit package name at ./multi-rtr-cmd.pl line 18. Global symbol "$command2" requires explicit package name at ./multi-rtr-cmd.pl line 20. Global symbol "$outputfile" requires explicit package name at ./multi-rtr-cmd.pl line 31. These are being generated by the piece of script below. I've tried all sorts of different quotes and reading various bits. Please help me on my learning path. # Read in the arguments into script variables if(!"@ARGV"){&Usage}; if($ARGV[0] eq "-i") {$hostfile = "$ARGV[1]"}; if($ARGV[2] eq "-o") {$outputfile = "$ARGV[3]"}; if($ARGV[4] eq "-c1") {$command1 = "$ARGV[5]"}; if($ARGV[6] eq "-c2") {$command2 = "$ARGV[7]"}; TIA, Neil. |
It looks like you have "use strict;" You will need to declare the variables with:
my $varname; |
All times are GMT -5. The time now is 04:44 PM. |