ashnator has asked for the wisdom of the Perl Monks concerning the following question:
I want to print the matches successively in a column but its printing only the first one
Example :-
My code isI am 60 years old I am 60 years old My code prints only 1 occurence not the successive ones. How to do tha +t ?
#!/usr/bin/perl -w $fn=<>; open(FH, "$fn") || die("Can't open:$!"); while(<FH>) { if($_ =~ /\w\s+\w+\s+\w+\s+\w+\s+\w+/) { print "$_"; } } close FH;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Howto print multiple matches in a line
by ikegami (Patriarch) on Nov 11, 2008 at 03:39 UTC | |
by ashnator (Sexton) on Nov 11, 2008 at 04:11 UTC | |
Re: Howto print multiple matches in a line
by motzi (Sexton) on Nov 11, 2008 at 03:39 UTC | |
Re: Howto print multiple matches in a line
by blazar (Canon) on Nov 11, 2008 at 12:09 UTC |
Back to
Seekers of Perl Wisdom