View Single Post
Old 18th November 2008
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
Join Date: Apr 2008
Posts: 537

Originally Posted by stukov View Post
Furhter testing indicates that :
foreach my $i (@$attributes)
    print $i . ENDL;
works but
foreach my $i (%$attributes)
    print $i . ENDL;
does not.

Now, how am I expected to provide a key-value pair when I need to work with an array?
like i said before, $attributes is an array reference and an array is not equivalent to a hash. you can't use an array reference as a hash reference or the other way around. (internally they have a different DS)

though, assigning an array to a hash and vice-versa is valid (with a caveat) , please see the example i gave earlier (#6).

Last edited by ephemera; 18th November 2008 at 07:34 PM.
Reply With Quote