Type of arg 1 to main::mygrep must be block or sub {} (not numeric eq (==)) at /tmp/mygrep line 7, near "10)" Execution of /tmp/mygrep aborted due to compilation errors. #### sub mygrep { my $s = "grep $_[0]"; eval $s; } print for mygrep('$_ % 2 == 0, 0..10'); # :-)