cztmonk has asked for the wisdom of the Perl Monks concerning the following question:
Good Morning Monks. I have a logfile containing
bla bla IP address:port bla bla IP address:port
I have this code to get the 1st IP/port. How do I get the 2nd one?
use strict; use warnings; use autodie; my @ipaddress; my $filename = "router.log"; my $myip = "10.0.0."; my $count = 0; open my $f, "<", $filename; while(<$f>){ $count++; while (/$myip/g){ if (m/(\d+\.\d+\.\d+\.\d+\:\d+)/){ push @ipaddress,$1; } } } close $f;
Back to
Seekers of Perl Wisdom