ronniec has asked for the wisdom of the Perl Monks concerning the following question:
On the command line I type the script name and the parameters and my counter always says that there are 0 supplied! eg script.pl(fred), script.pl fred & script "fred" all produce 0 parameters? Is there a difference or have I got a typo or just plain misunderstood something?# # Process the parameters #------------------------# $P_count = scalar @ARGV ; if ($P_count == 1) { $file_in = $ARGV[0] ; } elsif ($P_count == 2) { ($IP_in, $MAC_in) = @ARGV ; } elsif ($P_count == 3) { ($IP_in, $MAC_in, $Port_in) = @ARGV ; } else { print "\n\tIncorrect number of parameters supplied - ($P_count)" ; print "\n\tThere MUST be between 1 & 3 parameters!\n" ; exit 123 ; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't pass parameters in Win32 Perl Scripts
by Corion (Patriarch) on Oct 25, 2006 at 11:17 UTC | |
by ronniec (Sexton) on Oct 25, 2006 at 12:13 UTC | |
by Melly (Chaplain) on Oct 25, 2006 at 13:42 UTC | |
by pKai (Priest) on Oct 25, 2006 at 13:49 UTC | |
by Corion (Patriarch) on Oct 25, 2006 at 14:22 UTC | |
by pKai (Priest) on Oct 25, 2006 at 14:50 UTC |