in reply to Passing filehandles to subroutines
and then pass $fh around. If you want to be compatible with earlier versions, it is only slightly more verbose:open my $fh, "<", $filename;
And yes, this is definitely going to stay with us in Perl 5. In Perl 6 you'll be doing things entirely differently:use Symbol qw(gensym); # ... open +(my $fh = gensym), "<$filename";
Though the other syntax will probably remain supported. Still I'm definitely switching to this new construct as soon as possible.my $fh = open "<", $filename;
Makeshifts last the longest.
|
|---|