http://www.perlmonks.org?node_id=1040406


in reply to using grep to find a word

Don't have a Perl install on here to check it, but this is close...
#!/usr/bin/perl use strict; use warnings; my @words = qw( first second third% fourth% fifth); my @results = grep (/%$/, @words); print "Found:".join(",", @results)."\n" if (@results);
If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)