sub log_watch { ... my $timestamp = 0; ... if ( $line =~ m/^(\d+\/\d+\/\d+\s\d+\:\d+\:\d+\.\d+)/msx ) { $timestamp = $1; } ... return $timestamp; }