Noah schreef:
> Is there a way to simplify the following to one line?
>
> my $value = $t1lsq{$interfaceName};
> $value = 4 if $value > 4;
Not really. You might not want to get $t1lsq{$interfaceName} twice,
because of side effects for example, one being that it is just slower to
do things twice.
my $value = do{my $v=$t1lsq{$interfaceName};$v>4?4:$v};
my $value = $t1lsq{$interfaceName};$value=4 if $value>4;
Pretty alternative:
sub min { $_[0] < $_[1] ? $_[0] : $_[1] };
my $value = min 4, $t1lsq{$interfaceName};
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/