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