Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Strange Behaviour of Two Hashes

by buckaduck (Chaplain)
on May 17, 2005 at 23:03 UTC ( #458032=note: print w/replies, xml ) Need Help??


in reply to Strange Behaviour of Two Hashes

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://458032]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2022-12-02 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?