From 28275fce0361a2b721951131ef4a07f0ac0d22af Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 18 Oct 2012 20:50:48 +0000 Subject: simplify --- dhcp_wizard/Dhcp.pm | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'dhcp_wizard') diff --git a/dhcp_wizard/Dhcp.pm b/dhcp_wizard/Dhcp.pm index 055dd055..04de9634 100755 --- a/dhcp_wizard/Dhcp.pm +++ b/dhcp_wizard/Dhcp.pm @@ -141,27 +141,13 @@ $o->{pages} = { sub compute_range { my ($d, $s) = @_; - my $n; - if ($d <= 64) { - $n = "65"; - } elsif ($d <= 128) { - $n = "129"; - } else { - $n = "1"; - } + my $n = $d <= 64 ? "65" : $d <= 128 ? "129" : "1"; "$s.$n"; } sub compute_range2 { my ($d, $s) = @_; - my $n; - if ($d <= 128) { - $n = "254"; - } elsif ($d > 192) { - $n = "192"; - } else { - $n = "128"; - } + my $n = $d <= 128 ? "254" : $d > 192 ? "192" : "128"; "$s.$n"; } -- cgit v1.2.1