in reply to regex matching array values with foreach

Welcome back to Perl!

While you were away, the best practice for using open has improved and it is now strongly recommended to use lexical filehandles and the three-argument version of open. In other words, instead of saying

open (FH, "< $file") or die "Can't open $file for read: $!";
it's better to use
open (my $fh, "<", $file) or die "Can't open $file for read: $!";
In the new version, $fh is scoped like a regular variable (in the old way, FH is global) and passing < and $file as separate parameters helps to prevent some types of potential attacks by malicious users.

Also, a couple other general tips, which hopefully won't add to your confusion: