use strict;
use warnings;
my %array = (
'3' => 'apple',
'11' => 'orange',
'5' => 'banana'
);
my @key = sort {$a <=> $b} keys %array;
my @value = sort {$a cmp $b} values %array;
print "@key\n\n";
print "@value";
use warnings;
my %array = (
'3' => 'apple',
'11' => 'orange',
'5' => 'banana'
);
my @key = sort {$a <=> $b} keys %array;
my @value = sort {$a cmp $b} values %array;
print "@key\n\n";
print "@value";
No comments:
Post a Comment