It simply "doesn't work" because your regexp doesn't match your data. Not "/" but "." seperates the port from the IP.
while (<DATA>) { my ( $src_ip, $src_port ) = /IP\s+(\d+(?:\.\d+){3})\.(\d+)/; my ( $dst_ip, $dst_port ) = />\s+(\d+(?:\.\d+){3})\.(\d+)/; print "$src_ip $src_port $dst_ip $dst_port \n"; } __DATA__ 12-APR-03 12:20:46.902801 IP 10.60.0.114.2684 > 10.60.0.3.110: . ack 3 +927995843 win 0
In reply to Re: Need help in perl regexp
by Skeeve
in thread Need help in perl regexp
by Himi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |