I think this will do exactly what you want:
##########
# BEGIN
##########
# Define the regex to be used (instead of having to run
# multiple regex's)
my $regex = join('|', keys %hash);
my (%hash1, %hash2, @array1, @array2);
while ($line = <FILE>) {
if ($line =~ /^($regex)/) {...