use strict; use warnings; use File::ReadBackwards; my $log = ...; my $fh = File::ReadBackwards->new($log) or die "Cannot read '$log': $!"; my $found = 0; while (my $line = $fh->readline) { if ($line =~ /.../) # Identify a JVM line and capture the timestamp { ...; # Re-format the timestamp and export it $found = 1; last; } } warn "No log entry found\n" unless $found;