use strict; use warnings; my @starting=(); my @success=(); my @linetypes = ("Starting", "SUCCESS: Completed"); my $linetypes_re = join("|", @linetypes); open (LG, "path of the os.log"); @log=; for my $line (@log) { chomp $line; next unless $line; my ($linetype, $moudle, $year, $month, $day, $hh, $mm) = $line =~ m/^($linetypes_re) (.+$) at (\d{4})-(\d{2})-(\d{2})-(\d{2})(\d{2})\.$/ my $info = [$module, $year, $month, $day, $hh, $mm]; if ($linetype eq $linetypes[0]) { push @starting, $info; } elsif ($linetype eq $linetypes[1]) { push @succes, $info; } }