#!usr/bin/env perl use warnings; use strict; #### open my $test_fh, '<', @ARGV or die "Can not open file $!\n"; #### while (<$test_fh>) { #### my @line = split (); # if ($line[1] =~ /\wP\w/i); print "$line[1]"; #### close ($test_fh); #### #!/net/perl/5.10.0/bin/perl use strict; use warnings; die "Invalid number of arguments\nUsage: program \n" if @ARGV != 1; open my $fh, '<', $ARGV[0] or die "Can't open $ARGV[0]: $!\n"; while ( my $line = <$fh> ) { print "$_\n" # print one word per line for grep {/p/i} # select those with a p or P $line =~ /(\p{IsAlpha}+)/g; # Words only have letters # and match all of them } close $fh; __END__ CPAN comprehensive Perl expression pattern pattern operator Perl help