in reply to Number notation

You have a hash with two name/value pairs.
$var1 = "2000"; $var2 = "02"; $var3 = "2000"; $var4 = "2"; $var2 does not get interpolated - ie, "02" is not the same as "2" in t +he context you used. To force numerical context: $array{$var2} = $array{"02"} = undefined $array{$var2+0} = $array{"2"} = 125
1 and 2 are the only KEYS in the hash, so others are undefined. And I would rename %array to %hash to avoid confusion with this.

I suggest you read perldata document to familiarise yourself with Perl's data structures.

cLive ;-)

Update: - oops, misread (thanks Sifmole) - have amended above to explain.

Replies are listed 'Best First'.
Re: Re: Number notation
by Sifmole (Chaplain) on Jun 20, 2001 at 22:21 UTC
    cLive -- The exact confusion here is that "02" does NOT become "2" in $array{$var2}. If it did, then his result from $array{$var2} would be "125" not "undef".