Peter Scott wrote:
On Thu, 21 Aug 2008 21:55:46 -0700, Noah wrote:
Is there a way to simplify the following to one line?

                 my $value = $t1lsq{$interfaceName};
                 $value = 4 if $value > 4;

If you happen to already have

        use List::Util qw(max);

in your code (or don't mind adding it) then you can do

        my $value = max( 4, $t1lsq{$interfaceName} );

s/max/min/

:-)


John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to