Perl Monk, Perl Meditation | |
PerlMonks |
Re^3: Regex shows only last match multiple times?by Athanasius (Archbishop) |
on Aug 08, 2014 at 15:51 UTC ( [id://1096777]=note: print w/replies, xml ) | Need Help?? |
If you add use warnings; to the head of your script, Perl will tell you that the opening of the while loop:
contains a logic error: it re-initialises the variable to 1 on each loop iteration. In fact, this loop would benefit from a complete re-write:
This is one of the unusual cases in which a C-style for loop is useful in Perl. Please note:
Hope that helps,
In Section
Seekers of Perl Wisdom
|
|