in reply to Hashes of Hashes with Multidimensional array

..or consuming each array while is defined the first one:

# warning windows doublequotes! # Data::Dump is a bit better.. perl -MData::Dump -e "@ar1='A'..'E';@ar2=1..5;@ar3='a'..'e';$hash{shif +t @ar1}={shift @ar2=>shift @ar3} while @ar1; dd %hash" ( "A", { 1 => "a" }, "D", { 4 => "d" }, "C", { 3 => "c" }, "E", { 5 => "e" }, "B", { 2 => "b" }, )

..or, just to learning something, mixing the whole into a single assignement forcing map to return an anonymous hash {$_=>"something"}

perl -MData::Dumper -e "@ar1='A'..'E';@ar2=1..5;@ar3='a'..'e';@hash{@a +r1}=map{{$_=>shift @ar3}}@ar2;print Dumper \%hash" $VAR1 = { 'A' => { '1' => 'a' }, 'D' => { '4' => 'd' }, 'C' => { '3' => 'c' }, 'E' => { '5' => 'e' }, 'B' => { '2' => 'b' } };

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Hashes of Hashes with Multidimensional array
by Eshan_k (Acolyte) on Dec 15, 2016 at 20:10 UTC
    Thank you so much Discipulus for your help.
      Thank you so much Eshan_k for your reply Discipulus.
        Thank you so much for your irony Anonymous Monk

        L*

        There are no rules, there are no thumbs..
        Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.