in reply to split split

And another way...

You want the stuff between the first space and the first hash

$_ = "client 127.0.0.1#47560: query: host.example.com IN AAAA +"; (my $ip) = /\s(.*?)#/; print $ip; #127.0.0.1

Unless I state otherwise, all my code runs with strict and warnings