in reply to Re: (tye)Re2: forcing numeric context
in thread forcing numeric context
!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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: forcing numeric context
by Aristotle (Chancellor) on Dec 18, 2002 at 16:26 UTC | |
|
Re: (tye)Re3: forcing numeric context
by John M. Dlugosz (Monsignor) on Dec 18, 2002 at 17:00 UTC |