!1 returns Perl's "false" value. You can get the same effect via:
That is, the "false" value simply has a string value of "" and a numeric value of 0. Thus there is no warning when in numeric context since the 0 is simply fetched rather that it having to be computed from the empty string. - tyesub false { my $f= ""; { BEGIN { warnings->unimport() if $INC{"warnings.pm"}; } local( $^W )= 0; my $temp= 0+$f; } return $f; }
In reply to (tye)Re3: forcing numeric context
by tye
in thread forcing numeric context
by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |