in reply to hash array

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re^2: hash array
by johngg (Canon) on Dec 26, 2006 at 14:53 UTC
    I find your example rather misleading as your variable $HASH is not referring to a hash structure at all but to an array. You are using push, which pushes an element onto the right-hand, or top, end of an array and you are using the @ sigil to dereference $HASH to get at the array it refers to. You say "dump the whole hash" when using Data::Dumper but again you are supplying a reference to an array and, by enclosing the argument in anonymous hash constructors Data::Dumper->Dump([$HASH]), you are actually going to see an array of arrays in your output. Something like

    $VAR1 = [ [ 'data1', 'data2', 'data3' ] ];

    Later you loop over the array printing out each element but you confuse things again by referring to each as a key. Arrays don't have keys, hashes do. Also, why do you declare the scalar $value then never use it?

    Cheers,

    JohnGG