in reply to Re: $array[ 'Infinity' ]
in thread $array[ 'Infinity' ]
Update: explorer changed the content of the parent post without any indication, so now my reply no longer makes much sense. The parent post originally read that the string "Infinity" evalutes to zero in numeric context, thus 0+"Infinity" is 0, and -"Infinity" was -0.
Did you test it? Besides, why would $arr[0] be different than $arr[-0]?
I'm not sure I ever considered using infinity as an array offset. Nor did I guess that 0+"Infinity" would actually be infinity. It is cute that both do reasonable things.$ perl -le 'print 0+(-Infinity)' -inf $ perl -le 'print 0+("Infinity")' inf $ perl -v This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
blokhead
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: $array[ 'Infinity' ]
by ikegami (Patriarch) on Dec 16, 2007 at 23:38 UTC | |
by ysth (Canon) on Dec 17, 2007 at 01:38 UTC | |
by blokhead (Monsignor) on Dec 16, 2007 at 23:45 UTC |
In Section
Seekers of Perl Wisdom