...
Consequently, the original behavior of this program is restored. Because the $BAD
variable is declared with my
, it is a lexical variable rather than a package variable and is unaffected by the BAD
subroutine. So this program once again prints two lines from the good.txt
file and one from the bad.txt
file, and never confuses the two.
Exceptions
FIO00:EX0: According to Jeffrey Thalhamer [CPAN]:
There are three exceptions: STDIN, STDOUT and STDERR. These three standard filehandles are always package variables.
...
The following barewords are built-in to Perl and are exceptions to this rule:
ENV | STDIN |
INC | STDOUT |
ARGV | STDERR |
ARGVOUT | _ |
SIG |
|
Risk Assessment
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
FIO00-PL | medium | probable | low | P12 | L1 |
...
[Conway 2005] | "Filehandles," p. 202 |
[CPAN] | Jeffrey Thalhammer, Perl-Critic-1.118, InputOutput::ProhibitBarewordFileHandles |
[Wall 2011] | perlfunc, perlvar |
...