Python vs. Perl
Gisle Aas
gisle at ActiveState.com
Fri May 25 23:44:02 EDT 2001
"Tim Peters" <tim.one at home.com> writes:
> [Thomas Wouters]
> > ... Perl doesn't *have* integers that aren't strings. Perl just has
> > scalars, lists and associative arrays. But the tuples-as-keys is a huge
> > difference with perl hashes -- as far as I recall, that isn't possible.
> > Hash keys have to be scalars. I remember that being one of the
> > top-5 annoyances I had with Perl hashes :)
>
> You fake it in Perl like so:
>
> $hash{$key1, $key2} = $whatever;
This is mostly a perl4 legacy. I never seen it used in any modern
perl code. You would use:
$hash{$key1}{$key2} = $whatever;
instead.
--
Gisle Aas
More information about the Python-list
mailing list