> -----Original Message-----
> From: Booher Timothy B 1stLt AFRL/MNAC
> [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 12, 2002 7:37 PM
> To: [EMAIL PROTECTED]
> Subject: can't print input argument
> 
> 
> Hello - more trouble, I just can't seem to write a program 
> that prints an
> argument it's passed:
>  
> My script contains:
>  
> #not working
> print "$ARGV\n";
>  
> when I run this I get:
>  
> c:\work.pl "this"
>  
> c:\

>From perldoc perlvar:

      $ARGV   contains the name of the current file when reading from <>.

      @ARGV   The array @ARGV contains the command-line arguments intended
              for the script.  "$#ARGV" is generally the number of arguments
              minus one, because "$ARGV[0]" is the first argument, not the
              program's command name itself.  See "$0" for the command name.

So, you want @ARGV, not $ARGV:

   print "@ARGV\n";

>  
> confused by this but also confused that I can't run anything from the
> command line in windows. Like
>  
> c:\perl -e "s/Bad/Good/" test.txt
> or
> c:\perl -e 's/Bad/Good/" test.txt

What do you expect this to do? Change "Bad" to "Good" for all lines of
test.txt? If so, you need to add the -p option to set up a loop:

   c:\perl -pe "s/Bad/Good" test.txt

See perldoc perlrun for the details.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to