in reply to max_strl - Get length of longest string in a hash
In cases like this where I specifically expect a "ref to X" I might even consider using a prototype (in this case, \%;$), then you can get rid of your own type checking and it will work regardless of any magic attached to whatever is passed in.use List::Util qw(max); my $max_len_keys = max map length, keys %hash; my $max_len_vals = max map length, values %hash;
Makeshifts last the longest.
|
---|