#!/usr/bin/perl -w use strict; use diagnostics; # Iterate through each line of each file while (<>) { # Print the matching filename and line print "$ARGV: $_" if m/foo/; }