[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] if ($a > $b) { $b = $a }



I seem to write this pattern in my code a lot when I'm trying to find the maximum value of something:

if ($a > $b) {
   $b = $a;
}

Is there some slick Perl operator that does that cleaner?

That pattern gets pretty ugly in my real code. e.g.:

if ($running_simul{$type} > $stats{$type}{'max simul'}{$time}) {
    $stats{$type}{'max simul'}{$time} = $running_simul{$type};
}

j