in reply to Help with split() function
#!/usr/bin/perl use warnings; use strict; my $filename = shift; open my $TEST_FH, '<', "$filename" or die "Cannot open file $filename +\n$!\n"; while (<$TEST_FH>) { chomp; my @words = split; my @pmatch = grep {/p/i} @words; if (@pmatch) { foreach (@pmatch) { s/[^\w]$//; print "$_\n"; } } } close ($TEST_FH);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Help with split() function
by driver8 (Scribe) on Mar 19, 2008 at 18:03 UTC |