my ($srcip) = $whole_event_string =~ /^(\d+\.\d+\.\d+\.\d+)/;
####
\d+ one or more digits
\. a dot
\d+ one or more digits
\. a dot
\d+ one or more digits
\. a dot
\d+ one or more digits
####
#!/usr/bin/perl
use strict;
use warnings;
while (defined (my $whole_event_string = )) {
my ($srcip) = $whole_event_string =~ /^(\d+\.\d+\.\d+\.\d+)/;
print "\$srcip = $srcip\n";
}
__DATA__
1.2.3.4 - Unauth [09/Oct/2003: 10:12:06 -0700] "GET / HTTP/1.1" 200 1979
2.3.4.5 - Unauth [09/Oct/2004: 11:12:06 -0700] "GET / HTTP/1.1" 200 1979
3.4.5.6 - Unauth [09/Oct/2005: 12:12:06 -0700] "GET / HTTP/1.1" 200 1979
4.5.6.7 - Unauth [09/Oct/2006: 13:12:06 -0700] "GET / HTTP/1.1" 200 1979