foreach $line (@parsedfile) { if ($line =~ /cellpadding\=2/) { do whatever } }