Re: 'use strict' and filehandles




Timothy Johnson wrote:
If you want to pass a filehandle like that I would recommend using the
FileHandle module.

Why? What's the advantage of that over just using lexical filehandles?

As your script stands, however, you have no reason to pass the
filehandle to the subroutine.

Yes he does.

You can just do a "print ERRLOG $scalar" to print.

Except that he doesn't want the function to only print to ERRLOG, he
wants to choose which filehandle to print to based on what filehandle
is being passed to the function.

Paul Lalli

.



Relevant Pages

  • Re: filehandle to a member of a zip archive
    ... way I can make my subroutine take in a barwood operator for the ... you meant "bareword filehandle" instead. ... You can pass a type glob, or a reference to a type glob as ... How can I make a filehandle local to a subroutine? ...
    (comp.lang.perl.misc)
  • Re: use strict and filehandles
    ... > subroutine identifier, in curly brackets or to the left of the ... Using a bare word in the filehandle ... In this case a bare word does everything I need ... I guess use strict is trying to make sure I ...
    (perl.beginners)
  • angle operator behavior with filehandles in @_
    ... I can get around this by storing the filehandle ... in a scalar that I define in the subroutine. ...
    (comp.lang.perl.misc)
  • RE: use strict and filehandles
    ... If you want to pass a filehandle like that I would recommend using the ... I'm running into a Cach-22 with 'use strict', ... files, e.g. in code sample A below, ERRLOG and INFLOG are declared at ... A subroutine tries to pass 'ERRLOG' or 'INFLOG' to the 'log' ...
    (perl.beginners)
  • Re: angle operator behavior with filehandles in @_
    ... filehandle to a scalar, and then using the angle operator ... I can get the angle operator to work as I ... >> that is passed to a subroutine. ...
    (comp.lang.perl.misc)