Mega Code Archive

 
Categories / Perl / Language Basics
 

Passing Arguments at the Command Line

# The @ARGV array holds command-line arguments.  # If the ARGV filehandle is used, the arguments are treated as files. # #$ perlscript filea fileb filec print "@ARGV\n";  # lists arguments: filea fileb filec while(<ARGV>){    # filehandle ARGV -- arguments treated as files    print;         # Print each line of every file listed in @ARGV }