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.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to