If I stick a file handle into a hash, is there a way to read from the filehandle ala <$handle> without copying the file handle to a scalar first? Here's some code...
#! /usr/bin/perl -w -T use strict; # assuming 'foo' exists open( my $handle, '<', 'foo' ); my %hash = ( handle => $handle); # prints out GLOB(0x9d2cc28) while( <$hash{handle}> ) { print; } my %worse_yet = ( hash => \%hash ); # won't compile while( <$worse_yet{hash}->{handle}> ) { print; } # I tried *{$worse_yet{hash}->{handle}} and it didn't work either
In reply to Using File Handle in hash by pileofrogs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |