On 9/10/07, Jeremy Kister <[EMAIL PROTECTED]> wrote:
> I am trying to optimize some sorting code I have. The data structure is
> as follows:
>
> my %hash = (x => [ 'a','b','c' ],
> y => [ 'd','e' ],
> z => [ 'f' ],
> );
>
>
> The result I expect is simply the
On 9/10/2007 5:13 PM, Rob Dixon wrote:
use List::Util qw/max/;
my %hash = (x => [ 'a','b','c' ],
y => [ 'd','e' ],
z => [ 'f' ],
);
my $most = max map scalar @$_, values %hash;
Woah! That's fast! :)
thanks,
--
Jeremy Kister
http://jeremy.kister.net./
--
Jeremy Kister wrote:
I am trying to optimize some sorting code I have. The data structure is
as follows:
my %hash = (x => [ 'a','b','c' ],
y => [ 'd','e' ],
z => [ 'f' ],
);
The result I expect is simply the highest number of elements. In this
case, the
On 9/10/2007 4:45 PM, Jeremy Kister wrote:
if(@{$hash{$key}} > $highest){
oops, that's if(@{$hash{$key}} > $most){
not $highest.
--
Jeremy Kister
http://jeremy.kister.net./
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.