http://qs321.pair.com?node_id=11120867


in reply to storing values of hash of hashes in an array based on numerical order of second key

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11120854 use warnings; my %pos2base2bin = ( '315' => { '8' => 0 }, '329' => { '6' => 0 }, '352' => { '5' => 0 }, '390' => { '1' => 0 }, '280' => { '7' => 1 }, '360' => { '9' => 0 }, '349' => { '4' => 0 }, '305' => { '10' => 0 }, '380' => { '3' => 1 }, '251' => { '2' => 0 } ); local ($\, $,) = ("\n", "\t"); my @items = sort { $a->[0] <=> $b->[0] } map [%$_], values %pos2base2b +in; print 'sample', map $_->[0], @items; print 'file1', map $_->[1], @items;
  • Comment on Re: storing values of hash of hashes in an array based on numerical order of second key
  • Download Code