in reply to regex matching array values with foreach
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
it's better to useopen (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.open (my $fh, "<", $file) or die "Can't open $file for read: $!";
Also, a couple other general tips, which hopefully won't add to your confusion:
|
|---|