(C) 2003, Tim Maher 1-6 www.TeachMePerl.com perlgrep #! /usr/bin/perl -wln # Grep-like script that uses Perl regexes BEGIN { $USAGE="Usage: $0 'RE' [file ...]"; # must have pattern arg @ARGV > 0 or die "$USAGE\n"; # remove arg1 and load into $pattern $pattern=shift ; } # now @ARGV only contains filenames /$pattern/ and print; Examples perlgrep '\bBOB\b' tv_stars