Greetings fellow monks.
I solved my problem, but I am trying to understand the error message that preceded it, that I might gain wisdom from the experience.
When I leave off the <> operator on the while(<KNOWN_HOSTS> loop on line 83 in the below code snippet, the error is thrown from the close on line 92, instead of the while on line 83.
My question is: Why is the error not thrown from the while on 83?
while (KNOWN_HOSTS) { # this is line 83 $inline = $_; if (isOneOf($inline,@contexts)) { next; } else { print; } } close(KNOWN_HOSTS); # this is line 92
user@localhost ~$ ./strip_keys.pl -u user my-device.config Bareword "KNOWN_HOSTS" not allowed while "strict subs" in use at ./strip_keys.pl line 92. Execution of ./strip_keys.pl aborted due to compilation errors.
In reply to Why is the error thrown from close(FH) when the error is the missing <> on while(FH)? by techgrrl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |