/o.
   1 #!/usr/bin/perl -w
   2 my $what = shift @ARGV;
   3 while (<>) {
   4   if (/$what/o) { # compile only once
   5     print ;
   6   }
   7 }
Sigue un ejemplo de ejecución:
> mygrep.pl '\bif\b' *.pl
if ($input !~ m/^([-+]?[0-9]+(\.[0-9]*)?)\s*([CF])$/i) {
  if ($type eq "C" or $type eq "c") {
  push(@fields, undef) if $text =~ m/,$/;
  next if !s{
  next if !s/\b([a-z]+)((\s|<[^>]+>)+)(\1\b)/\e[7m$1\e[m$2\e[7m$4\e[m/ig;
  if (/$what/) {
Casiano Rodríguez León
