yep, sorry for reading the message too fast

I saw after when reading the post with the
my @color_array = (
                   ["sky", "blue"],
                   ["grass", "green"],
                   ["apple", "red"]
                   );

that there was a key/value
:-)

RaFaL Pocztarski wrote:

> Etienne Marcotte wrote:
>
> > if you only want to print what's in your hash, you can do
> >
> > my %hash = qw(sky blue grass green apple red);
> > foreach (%hash){ print "$_ = $hash{$_}"; }
>
> Have you tried that code? It will print:
>
>   grass = greengreen = apple = redred = sky = blueblue =
>
> %hash in a list context will return a list ('sky', 'blue', 'grass',
> 'green',
> 'apple', 'red') but only 'sky', 'grass' and 'apple' are the keys. It
> should
> be something like:
>
>   print "$_ is $hash{$_}\n" for keys %hash;
>
> or better, use each %hash (unless you want a sorted order, and if you do
> use for sort keys %hash).
>
> > But since your hash doesn't have a key->valyue pattern, I don't know why
> > it's not stored in a simple array..
>
> It does have key->value pattern, like every hash.
>
>   my %hash = qw(sky blue grass green apple red);
>
> means the same as:
>
>   my %hash = (sky=>'blue', grass=>'green', apple=>'red');
>
> - RaFaL Pocztarski, [EMAIL PROTECTED]
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

S/MIME Cryptographic Signature

Reply via email to