Hello James,
Friday, June 29, 2001, James Kelty <[EMAIL PROTECTED]> wrote:
JK> I was wondering if someone could help me with the following code bit. It
JK> is acting strangely.
JK> if($ARGV[0] =~ m/^-l$|^-list$/i) {
JK> print "What ports? (Press return after each port and CRTL-D when done.)";
JK> chomp(@getem = <>);
you mean, 'chomp(@getem = <STDIN>);' ?
JK> print "Who do you wanna hit, Homie? ";
JK> chomp($peer = <>);
JK> foreach $item (@getem) {
JK> &pointscan($item);
JK> }
JK> }
JK> else{
JK> print "$ARGV[0] bad flag. \"-l|-list\" only good option\n";
JK> exit(0);
JK> }
JK> I am trying to take "-l" or "-list" as a command line argument, but it
JK> bombs out with this error when run.
JK> james@warbaby:~/perl > ./sinner.pl -l
JK> What ports? (Press return after each port and CRTL-D when done.)
JK> Can't open -l: No such file or directory
JK> Who do you wanna hit, Homie?
perldoc perlop
....
The null filehandle <> is special: it can be used to emu-
late the behavior of sed and awk. Input from <> comes
either from standard input, or from each file listed on
the command line. Here's how it works: the first time <>
is evaluated, the @ARGV array is checked, and if it is
empty, "$ARGV[0]" is set to "-", which when opened gives
you standard input. The @ARGV array is then processed as
a list of filenames.
...
Best wishes,
Maxim mailto:[EMAIL PROTECTED]