|Do you know where your variables are?|
Re^2: globbing filehandles in arraysby why_bird (Pilgrim)
|on Jan 26, 2009 at 08:35 UTC ( #738879=note: print w/replies, xml )||Need Help??|
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?Thanks
Those are my principles. If you don't like them I have others.
-- Groucho Marx
In Section Seekers of Perl Wisdom