in reply to filehandler stored in hash-ref
You can get the print to work if you wrap the filehandle in a block.
my $s = {} ; open $s->{out}, '>', 'out' or die "open: $!\n"; print { $s->{out} } "test"; close $s->{out} or die "close: $!\n";
Note that if you're reading from a filehandle in an array, you have to store it in a scalar for the diamond operator to work.
my $fh = $s->{in}; my $line = <$fh>;
If that's too much trouble, you can use readline.
|
---|
In Section
Seekers of Perl Wisdom