my $file = $ARGV[0]; #### script.pl word file1 file2... #### my $word = shift; while (<>) { # Reads the files line by line, # ... $ARGV contains the filename. }