Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Re: Re^4: m//g behaves strange... (!1)

by ysth (Canon)
on Nov 10, 2003 at 07:14 UTC ( #305811=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re^4: m//g behaves strange... (!1)
in thread m//g behaves strange...

You beat me out - I had an almost identical reply ready when I saw yours. Let me just add that ~ tries to use an integer value even if only a floating-point value is set, and even if it is out of integer range (which can result in some strange results.)

Also, for any of the bitwise/stringwise ops (~, &, ^, |), quote the variable to force stringwise semanics if you are unsure where it has been:

$ perl -wle'$x="abc"; print ~$x; print $x+0; print ~$x; print ~"$x"' z?o Argument "abc" isn't numeric in addition (+) at -e line 1. 0 18446744073709551615 z?o


Comment on Re: Re: Re: Re^4: m//g behaves strange... (!1)
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (15)
As of 2015-07-29 11:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls