use strict; use warnings; open DATA, "db.txt" or die $!; my @array; while() { chomp; # save the line in our array push @array, $_; # see if it matches if ($_ =~ /(.*)(\d+:\d+:\d+)(.*?)/g) { # do code } }