You're using 3-arg open which was introduced at the same time as lexical file handles, so it's not a backwards compatibility issue.
Wow, I have to say I'm surprised that I really didn't know about something as basic as that!! Just goes to show what perlmonks can teach you. Strange also because I've found the global non-lexical file handles a real pain in the past and have never realised you could do it like that. I consider myself well and truly corrected (and pleased!)
For future reference, here is the (most?) relevent perldoc documentation, which strangely I hadn't come across (or perhaps rather read thoroughly) before. Also, perlopentut says the above explicitly, which I notice now that I come to look for it!
It still seems to be true though that the vast majority of examples in open and perlopentut are given using those old global filehandles, which I find a bit strange if it's not 'recommended' behaviour (I would certainly not recommend it!). Is this just because the documentation is old, or is there another reason?
ThanksIn reply to Re^2: globbing filehandles in arrays
by why_bird
in thread globbing filehandles in arrays
by why_bird
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |