in reply to How do I use command line arguments?

Just to deal with the part of reading command line arguements, as was pointed out, they are stored in @ARGV, i.e.
... if ( @ARGV != 2 ) { # check that you have the proper number of args print "usage: $0 pattern infile_name\n"; exit; } my ($pattern, $infile_name) = @ARGV; ...
I generally like to check that i have the proper command line args before i do anything else, although this checking is often more complicated.