in reply to Passing filehandles to subroutines
Basically, a reference to a glob can be used just like a glob to mean the associated file handle. In Perl 5.6 I think the open function will auto-vivify to just that, so you don't need to use a module or tricks to create a reference to an anonomous glob anymore. There's been discussions on that here; I posted a question concerning using this as the prefered method moving forward, when I heard about the auto-vivification.open (my $in, $infile) or die; foo ($in); sub foo { my $file= shift; print $file "Some Stuff."; # note no comma }
—John
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Passing filehandles to subroutines
by ibanix (Hermit) on Jan 27, 2003 at 07:11 UTC | |
by John M. Dlugosz (Monsignor) on Jan 27, 2003 at 07:45 UTC | |
by Aragorn (Curate) on Jan 27, 2003 at 08:19 UTC | |
by castaway (Parson) on Jan 27, 2003 at 07:19 UTC |