in reply to Re: How does ~~ force string interpolation of code into scalar context?
in thread How does ~~ force string interpolation of code into scalar context?

Note that it won't work on references.
Or floating point numbers.
sub PI { 4 * atan2 1, 1 } print "The value of PI is ${\~~PI}\n";
Result:
The value of PI is 3
Ouch. That's a bit coarse.

The truth is: bitwise not only works on strings, and on integers. It works differently on both, though the net result of double not is pretty the same: restoration of the original string, or the original integer.

  • Comment on Re: Re: How does ~~ force string interpolation of code into scalar context?
  • Download Code