in reply to Re^2: modules, exporting, and indirect filehandles
in thread modules, exporting, and indirect filehandles
It looks fine, and it works for me when I run that. Are you sure you're using the files you think you are using.
By the way, \* in return \*$fh; is useless. return $fh; will return the same thing.
Starting with Perl 5.6, open accepts the mode and file name as seperate arguments. It's safer to use the three argument form and concatenating the mode and file name:
sub open_file { my ($mode, $file) = @_; my $fh = gensym(); open $fh, $mode, $file or croak("could not open '$file': $!"); return $fh; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: modules, exporting, and indirect filehandles
by chromatic (Archbishop) on Aug 09, 2005 at 20:31 UTC | |
by ikegami (Patriarch) on Aug 09, 2005 at 20:35 UTC | |
|
Re^4: modules, exporting, and indirect filehandles
by eff_i_g (Curate) on Aug 09, 2005 at 21:11 UTC |