Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Re: extracting numbers with a regex

by Fastolfe (Vicar)
on Dec 05, 2001 at 11:25 UTC ( #129544=note: print w/ replies, xml ) Need Help??


in reply to Re: extracting numbers with a regex
in thread extracting numbers with a regex

I'd even go so far to recommend against doing 0 + '4568' because it's really pretty meaningless. A scalar is a scalar. If there's a number in there, use it like a number and it will act like a number. The only time we should have to resort to 0+ trickery is when there's some ambiguity (e.g. we want to treat "123abc" as "123" numerically, or "0E0" for similar reasons) or we need to do some black magic. Using it unnecessarily complicates code needlessly and makes it harder to read. I've actually seen code where the coder wrote something like: $i = "123"+0 because he didn't quite understand that the two data types were interchangeable in Perl. Scary!


Comment on Re: Re: extracting numbers with a regex
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (16)
As of 2014-10-21 17:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (106 votes), past polls