Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Max value

by choroba (Cardinal)
on Apr 16, 2019 at 14:17 UTC ( [id://1232662]=note: print w/replies, xml ) Need Help??


in reply to Max value

my %hash_name = (a => 1, b => 2, c => 3); my $max = (keys %hash_name)[0]; $hash_name{$_} > $hash_name{$max} and $max = $_ for keys %hash_name; print $max;

or using List::UtilsBy:

use List::UtilsBy qw{ max_by }; my %hash_name = (a => 1, b => 2, c => 3); my $max = max_by { $hash_name{$_} } keys %hash_name; print $max;

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1232662]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found