... 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; ...