Perhaps you mean something other than I do?
If I had to guess — and I do — I think he does mean something different than you do. I understand the points both of you are trying to make.
Your two examples "work differently" only because you are, in reality, providing different data and interpretting the answer differently. It'll come as no surprise to you that they work the same if you make other things equal...
and I think that's pg's point.print ~"3"; print pack("c",~ord("3")); # Or... print ~3 print unpack("L", ~"\x00\x00\x00\x03");
Your point, however, is really that Perl does treat strings and integers differently. And it's a good point. Another example that clears things up a bit:
So, you're both right. :-)$x = "3"; print ~$x; # This is... $x = 3; print ~$x; # Not the same as this... $x .= ""; print ~$x; # But, after stringification, it is.
-sauoq "My two cents aren't worth a dime.";
In reply to Re: Re: Re: How does ~~ force string interpolation of code into scalar context?
by sauoq
in thread How does ~~ force string interpolation of code into scalar context?
by davido
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |