foreach (@template2) { $_ =~ tr/ //d; if ($_ eq " ") { next; } push @template,$_; }