in reply to Syntax error when trying to use a hash value as a file stream specifier
may I suggest you use the approach to call print as a direct method?
> perl -de0 ... DB<108> open my $x, ">", \$out; $h{k}=$x DB<109> $h{k}->print("bla") DB<110> p $out bla DB<111> open FH, ">", \$out2; $h{k2}=FH DB<112> $h{k2}->print("bla") DB<113> p $out2 bla DB<114>
NB: I directed the output to $out vars only for demo purpose, it will work with all destinations.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) bareword FH, glob *FH, glob-ref \*FH, ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Syntax error when trying to use a hash value as a file stream specifier
by LanX (Saint) on Sep 03, 2022 at 12:47 UTC |