--- Mike Breeze <[EMAIL PROTECTED]> wrote:
> ---------- Original Message ----------------------------------
> From: "Evgeny Goldin (aka Genie)" <[EMAIL PROTECTED]>
> >
> >> CODE 3:
> >> printit(*Some_Handle);
> >
> >> CODE 4:
> >> printit(\*Some_Handle);
> >
> >
> >If you're choosing between those two - CODE 4 looks better as it
> passes
> >the reference to typeglob instead of the typeglob itself and passing
> >references is always the better way to do things.
> >CODE 4 is a usual way for passing "filehandles" and I personally use
> it ..
> >
> >Going further we may discover a proper modules for handling such
> >things - Joseph Hall in his "Effective Perl Programming" offers to
> use
> >IO::File.
Personally, I recommend using FileHandle objects, which are anonymous
references you can save in any scalar and then pass about and use just
like any other filehandle. They even work neatly in recursive
functions, because you can assign them to my()'d vars. All you need is:
use FileHandle;
my $fh = new FileHandle $file; # or ">$file", or whatever
some_func($fh);
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/