http://www.perlmonks.org?node_id=774186


in reply to split split

If you really need the 'ip address', you can use the right expression.
use Regexp::Common qw/net/; + my $ip_regexp = qr($RE{net {IPv4}); + while(<DATA>) { + if (/($ip_regexp)/) { + my $ip_address = $1; + print "$ip_address\n"; + } + } + + __DATA__ + client 127.0.0.1#47560: query: host.example.com IN AAAA +
--Artist