Re: passing parameters to Perl script

2001-06-28 Thread Brett W. McCoy

On Thu, 28 Jun 2001, Scott Taylor wrote:

> How can I pass parameters from *nix command line to a Perl script?
>   Like $1 in shell scripting.
>
> #!/usr/bin/perl -w
>
> $myfile = $1;

This will:

my $file = $ARGV[0];

@ARGV contains all of the command-line parameters.

-- Brett
   http://www.chapelperilous.net/btfwk/

There's no such thing as a free lunch.
-- Milton Friendman




Re: passing parameters to Perl script

2001-06-28 Thread Jeff 'japhy' Pinyan

On Jun 28, Scott Taylor said:

>How can I pass parameters from *nix command line to a Perl script?
>  Like $1 in shell scripting.

You want the @ARGV array.  $ARGV[0] is the first argument to your
program.  Check the 'perlvar' documentation for more about @ARGV.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **




passing parameters to Perl script

2001-06-28 Thread Scott Taylor

Hello,

How can I pass parameters from *nix command line to a Perl script?
  Like $1 in shell scripting.

#!/usr/bin/perl -w

$myfile = $1;

doesn't work.

Thanks.

Scott