#!usr/bin/env perl use warnings; use strict; while () { my @words = split (); my @pWords = grep {/p/i} @words; print "Line $. contains "; if (@pWords) { print "the following words containing p: @pWords\n"; } else { print "no words containing p\n"; } } __DATA__ CPAN stands for comprehensive Perl Archive Network. ^ and $ are used as anchors in a regular expression. /pattern/ is a pattern match operator. Perl is very easy to learn. Enter 'H' or 'h' for help.