http://www.perlmonks.org?node_id=655293

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; } }