asdfghjkl has asked for the wisdom of the Perl Monks concerning the following question:
hi monks,
i had small retrival code in my project..
i need to match three consecutive copies of what ever is contained currently in $string .If $string=abc then it should match for abcabcabc
i had implemented a code for this one. can any one suggest a better code to this??
#!/usr/bin/perl -w my $string = "rid"; while (<>) { if (/($string){3}/) { print; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: can any reply out with a better code than this??
by ysth (Canon) on Dec 06, 2007 at 07:27 UTC | |
Re: can any reply out with a better code than this??
by fenLisesi (Priest) on Dec 06, 2007 at 07:44 UTC | |
by asdfghjkl (Initiate) on Dec 06, 2007 at 07:50 UTC | |
by fenLisesi (Priest) on Dec 06, 2007 at 07:53 UTC | |
by asdfghjkl (Initiate) on Dec 06, 2007 at 07:57 UTC | |
by fenLisesi (Priest) on Dec 06, 2007 at 08:06 UTC |
Back to
Seekers of Perl Wisdom