Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Strange Behaviour of Two Hashesby buckaduck (Chaplain) |
on May 17, 2005 at 23:03 UTC ( [id://458032]=note: print w/replies, xml ) | Need Help?? |
The error is on line 109:
if ((my @gaps) = ($asstr =~ m/$regex/o))
The /o in your regex is telling Perl to compile the regular expression only once because the string $regex is never going to change. But it does change, because you call the subroutine more than once. Therefore, the regex gets compiled differently, depending on which call to the align() subroutine occurs first.
The way to fix it is to remove the /o from the regex: if ((my @gaps) = ($asstr =~ m/$regex/)) buckaduck
In Section
Seekers of Perl Wisdom
|
|