http://www.perlmonks.org?node_id=657337


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]?

$ 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
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.

blokhead