Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^4: Extracting text from a line

by pemungkah (Priest)
on Jul 13, 2010 at 00:37 UTC ( #849136=note: print w/ replies, xml ) Need Help??

in reply to Re^3: Extracting text from a line
in thread Extracting text from a line

Vivek, I strongly disagree with you here because of the fact that the number variables are very fragile: they are global to every pattern match.

If someone else comes along and adds (for instance) a"harmless" subroutine call that sometimes does a pattern match of its own between the match and the usage of $1, then the results are unpredictable because the intervening match has reused the global variables.

If you always capture the value in a separate variable immediately, you're safe from this potential bug.

Comment on Re^4: Extracting text from a line

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (17)
As of 2015-10-13 14:07 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (307 votes), past polls