There is no need to use regular expression for this needs, split
is enough. You could split your string at /
and :
, then the third field is ip address and fourth field port number.
#!/usr/bin/perl
use strict;
use warnings;
use feature qw(switch say);
use Data::Dumper;
while (<DATA>) {
chomp;
my @field = split /\/|:/;
print "$field[3] $field[4]\n";
}
__DATA__
udp://10.111.80.95:8081
Running:
$ perl t.pl
10.111.80.95 8081