[perl-python] 20050118 keyed list

Jürgen Exner jurgenex at hotmail.com
Tue Jan 18 09:35:57 EST 2005


Xah Lee wrote:
> © # in perl, keyed-list is done like this:

Just FYI: those thingies are called hashes. The legacy name would be 
associative array.

> © %a = ('john',3, 'mary', 4, 'jane', 5, 'vicky',7);
> © use Data::Dumper qw(Dumper);
> © print Dumper \%a;

Wow, my compliments. The very first time that using Data::Dumper actually 
may do something useful (formats the data more nicely). Still, why you are 
passing a reference is beyond me.

> © # the syntax of keyed list in Perl is too complex
> © # to be covered in a short message.

Excuse me? If (using the same examples as for your Python section)
    print "Mary is $a{mary}";
    delete $a{vicky}; print %a;
    print keys(%a);
    exists $a{mary};
is too complex for your to cover, then I strongly suggest you stop posting 
your "explanations".

> © # see "perldoc perldata" for an unix-styled course.

Excuse me? Do you mind explaining where exactly perldata is "Unix-styled"?

jue 





More information about the Python-list mailing list