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

Jay Hannah jhannah at omnihotels.com
Thu Jan 20 08:56:45 PST 2005


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




More information about the Omaha-pm mailing list