in reply to Re^9: Is there a problem with using barewords as filehandles ?
in thread Is there a problem with using barewords as filehandles ?
Almost
use strict; use warnings; MAIN: { open my $fh,">","filename"; ... nose(); ... } sub nose {...;}
nose() won't have access to any lexical vars defined inside the main block.
> I can’t tell how often I’ve been blamed for it.
It's a variation of putting the main code into a main() sub and calling it from the start.
I think it's a pattern taken from C and I've seen some monks here advocating it.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^11: Is there a problem with using barewords as filehandles ?
by karlgoethebier (Abbot) on Jul 08, 2020 at 22:51 UTC |