my $portmap; if ($port > 1999 and $port < 2100) { $portmap = '3' . substr($port, 2, 2) . '0'; } else { $portmap = $port; }