Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Turn this:
$VAR1 = { 'myname1' => { 'x' => '13', 'y' => '2', 'z' => '41', }, 'myname2' => { 'x' => '6', 'y' => '6', 'z' => '22' } }
into this:
$VAR1 = { { 'x' => '13', 'y' => '2', 'z' => '41', }, { 'x' => '6', 'y' => '6', 'z' => '22' } }
What I did was remove the 'myname1' and 'myname2'.

jdporter - edited - title and html formatting

Replies are listed 'Best First'.
Re: How do I make a hash entry anonymous
by QM (Parson) on Mar 24, 2004 at 20:22 UTC
    Hash entries need keys. If you don't want keys, you have an array (or array reference). This might do what you want (for some value of want):
    $VAR1 = [ # changed '{' to '[' { 'x' => '13', 'y' => '2', 'z' => '41', }, { 'x' => '6', 'y' => '6', 'z' => '22' } ] # changed '}' to ']'

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

Re: How do I make a hash entry anonymous
by Anonymous Monk on Mar 24, 2004 at 20:27 UTC

    To do it via code is extremely simple: $VAR1 = [ values %$VAR1 ];. This will give you an array of hashes, not a hash of hashes as you posted.