in reply to Re^2: Bareword vs. Indirect Filehandle behaviour
in thread Bareword vs. Indirect Filehandle behaviour

Just one opinion, but I think your asking perl to extend an idiom rather than to not break one. The old idiom is still there.

For me, it would be quite confusing if Perl extended the idiom so that "print $outFH;" was a write of "$_" to a specified filehandle, rather than a write of a variable to STDOUT. I have no doubt Perl could get it right, because it knows what variables are file handles and what aren't. I'd just have trouble reading it without my eyes getting caught in the wrong mode; I'd have to mentally back-track each time I read it.

  • Comment on Re^3: Bareword vs. Indirect Filehandle behaviour

Replies are listed 'Best First'.
Re^4: Bareword vs. Indirect Filehandle behaviour
by chromatic (Archbishop) on Sep 19, 2006 at 17:01 UTC
    I have no doubt Perl could get it right, because it knows what variables are file handles and what aren't.

    In general, Perl actually can't know this. It's reasonably easy to make a Perl object that can act as a file handle as well as a string, depending on how you use it.

Re^4: Bareword vs. Indirect Filehandle behaviour
by johngg (Canon) on Sep 19, 2006 at 11:04 UTC
    Good point.

    I'm looking at this as the bloke writing the code so I know it's a filehandle. The poor devil maintaining my code once I've moved on will, as you say, keep having to backtrack. Three extra keystrokes it is, then :-)