in reply to Number notation
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.$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
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 |