in reply to Re: Dereference a reference to a file handle created with IO::File
in thread Dereference a reference to a file handle created with IO::File
Yeah, this is a place you need to pay careful attention to the wording. It has to be a scalar variable, not just a scalar.
Like foo() could return a scalar, and that scalar could be a reference to a filehandle. But print foo() "string\n" will fail because even though foo() evaluates to a scalar, it's not a scalar variable. Nor is $foo{'somekey'}.
Same as you're not allowed to do:
my %foo; for $foo{'somekey'} ( @arr ) { ...; }
|
|---|