Check beginning and end
#!/usr/bin/perl -w foreach $patt (@ARGV) { # Check beginning and end. if ($patt =~ /^perl$/) { print "\tFound only perl in \"$patt\".\n"; } }