Front page | perl.beginners |
Postings from September 2009
Re: Hash of Hashes
Thread Previous
|
Thread Next
From:
Shawn H Corey
Date:
September 29, 2009 05:41
Subject:
Re: Hash of Hashes
Message ID:
4AC20008.5070505@gmail.com
Jeff Peng wrote:
> That's in Python? :-)
Wouldn't know, don't do Python.
> Perl's both hash and array use ().
> But anonymous hash and array use {} and [].
>
Hashes use {}, arrays use [], lists use ().
When you set an element of a hash, you use {} to surround its key:
$hash{$key} = $value;
When you set an element of an array, you use [] to surround its index:
$array[$index] = $datum;
When you set both to a list, surround the list with ():
%hash = ( 1, 2, 3, );
@array = ( 'a', 'b', 'c', );
See `perldoc perldata` for more details.
http://perldoc.perl.org/perldata.html
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
I like Perl; it's the only language where you can bless your
thingy.
Thread Previous
|
Thread Next