{ my $range; do { $range = ; } while (not ($range =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/)); ... }