in reply to Printing a Hash Slice problem

If I understand your requirements correctly, something like the following should work:

my $HoA_ref = {'GAT' => [2, ['ttt',-3,1],['ttc',-3,3],['ccc',-1,2]], 'AAA' => [13,['aaa',-1,2],['atg',-2,2]], 'TTT' => [11,['tta',-2,1],['atc',-3,3]] }; # Find key associated with highest value my ($key, $max); for(keys(%{$HoA_ref})) { if( $HoA_ref->{$_}[0] > $max ) { $key = $_; $max = $HoA_ref->{$_}[0]; } } # output the item with the max value print "$key $max:\n"; my @out = @{ $HoA_ref->{$key} }; # skip zeroth element for(1..$#out) { print join ',', @{ $out[$_] }, "\n"; }

Replies are listed 'Best First'.
Re^2: Printing a Hash Slices problem
by Roy Johnson (Monsignor) on Feb 28, 2005 at 18:59 UTC
    Or (because I like slices)
    # skip zeroth element for(@out[1..$#out]) { print join ',', @$_, "\n"; }
    or even
    # skip zeroth element print "$_\n" for map { join ',', @$_ } @out[1..$#out];

    Caution: Contents may have been coded under pressure.