#!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. #### Line 1 contains the following words containing p: CPAN comprehensive Perl Line 2 contains the following words containing p: expression. Line 3 contains the following words containing p: /pattern/ pattern operator. Line 4 contains the following words containing p: Perl Line 5 contains the following words containing p: help.