my $whole_event_string = '1.2.3.4 - Unauth [09/Oct/2003: 10:12:06 -0700] "GET / HTTP/1.1" 200 1979'; my ($srcip) = $whole_event_string =~ /^(\d+\.\d+\.\d+\.\d+)/; die 'I read perlintro ', $srcip; __END__ I read perlintro 1.2.3.4 at - line 6.