http://www.perlmonks.org?node_id=259887


in reply to Re: Re^3: A set of new operators. In keeping with the design of Perl? (aliasing)
in thread A set of new operators. In keeping with the design of Perl?

As for the single-pass problem, you can do that too:
use List::Util qw(reduce); @hash{$set}{qw(min max)} = @{ reduce { return [ $a, $b ] if 'ARRAY' ne ref $a; return $a->[0] < $b ? [ $b, $a->[1] ] : $a->[1] > $b ? [ $a->[0], $b ] : $a; } @{$hash{$set}{data}} };
Admittedly more hoop jumping here. Of course that doesn't address the memory problem, but in that case I'd still opt for a counter in a while loop instead. (In keeping with the corresponding use of while and each to traverse a hash.)
for my $min ($hash{$set}{min}) { my $data = $hash{$set}{data}; my $i = -1; while(++$i < @$data) { $min = $min < $data->{$i} ? $min : $data->{$i}; } }

Makeshifts last the longest.