open(MYFILE, '/dir/logfiles'); @data = MYFILE; foreach $line (@data) { if ($line =~ /^Data Record:(.*)/){ push(@push, $1); }else{ next; } }