develooper Front page | perl.beginners | Postings from January 2002

take the file name in as an argument of the function

Thread Next
From:
Booher Timothy B 1stLt AFRL/MNAC
Date:
January 16, 2002 08:03
Subject:
take the file name in as an argument of the function
Message ID:
30C9E24891FFD411B68A009027724CB701A22DCA@eg-002-015.eglin.af.mil
Hello all.

I want to be able to take the file name in as an argument of the function,
for example:

%Extract.pl MyFile.txt

I know that I could use:

#!/usr/bin/perl
while (<>) {

}

But how could I take two arguments from the command line:

i.e. my guess:

%Test.pl "Foo" "Bar"

#/!/usr/bin/perl
 $A = $ARGV[0];
 $B = $ARGV[1];
	print "Thing A: $A          Thing B: $B";

Thanks,

Tim

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About