my $x = 0; foreach $y (@lots_of_values){ $x = [ $x => $y ] -> [ $x <= $y ]; } return $x;