#!/usr/bin/perl
use strict;
use warnings;
my (%HoHoA);
@{$HoHoA{'1'}{'1'}} = (1..10);
@{$HoHoA{'1'}{'2'}} = (11..20);
@{$HoHoA{'1'}{'3'}} = (21..30);
@{$HoHoA{'1'}{'4'}} = (31..40);
&print_ed(\%HoHoA);
sub print_ed{
my ($rHoHoA) = @_;
foreach my $kA (keys %{$rHoHoA}){
foreach my $kB ( sort{$rHoHoA->{$kA}{$b}[1] <=> $rHoHoA->{$kA}{$a}[3] } keys %{$rHoHoA->{$kA}}){
print "$kA : $kB\t " , join("\t",@{$rHoHoA->{$kA}{$kB}}) , "\n";
}
}
}
Resul
$ perl blog.pl
1 : 4 31 32 33 34 35 36 37 38 39 40
1 : 3 21 22 23 24 25 26 27 28 29 30
1 : 2 11 12 13 14 15 16 17 18 19 20
1 : 1 1 2 3 4 5 6 7 8 9 10
0 comentários:
Post a Comment