in reply to Re: Regex substitute matches second match first?
in thread Regex substitute matches second match first?

As a minor nit, you can do away with this $1 stuff and assign directly to $ip like this:
if (my ($ip) = $line =~ /\[(\d+\.\d+\.\d+\.\d+)\].*Relay access denie +d/) { print "$ip\n"; }