mephit has asked for the wisdom of the Perl Monks concerning the following question:
I was skimming my older nodes and came across this reply, which says:
What I'm wondering, is if that's a numeric constant thing? If @_ is empty, does the array usage of [] force the undefined $_[0] into numeric context, which would make is a 0? Is that how that works? I did some tests, such as:
which is what I was expecting, thinking that an undef would be forced into a numeric 0 because of arithmetic operands. So, I'm pretty sure that's what's happening, but that's just an educated guess. Am I right?Enter h or `h h' for help, or `man perldebug' for more help. h main::(-:1): h DB<1> x $ARGV[0] 0 undef DB<2> x 3 + $ARGV[0] 0 3 DB<3> x 3 * $ARGV[0] 0 0
Thanks.
--
Mephit (See my home node for my rant about Opera and PerlMonks, and my earliest nodes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is this a numeric context thing?
by davorg (Chancellor) on May 17, 2002 at 07:01 UTC |