if ( /567./ ) { # port 2 } elsif ( /56../ ) { # port 1 } elsif ( /5.../ ) { # port x } else { # what do we do in this case? }