Perl implementation of lgrep