in reply to split split
If you are sure about the format of your input data (order of fields, number of whitespaces, ...), you can try something like this:
my $line = 'client 127.0.0.1#47560: query: host.example.com IN AAAA +' +; my ( $ip, $host ) = ( split /[ #]/, $line, 6 )[1,4]; print "IP: $ip, HOST: $host\n";
|
|---|