in reply to Regex for IP and Optional Port

Lordy! That's a bit long!

I'd go for something like this:

my ($ip1, $port1, $ip2, $port2) = ($inLine =~ m|^from ([0-9.]+)/?([0-9]*) to ([0-9.]+)/?([0-9]*) on in +terface$|)
(Untested but should be roughly right)

hth,
andy.

update: changed the delimiter for obvious reasons