⭐ in reply to How do I treat a string like a filehandle?
Per perlfunc:open; 'File handles can be opened to "in memory" files held in Perl scalars via:Though if you try to re-open STDOUT or STDERR as an "in memory" file, you have to close it first.'open( $fh, '>', \$variable) || die ....
Another example provided in the POD is:
open(MEMORY, '>', \$var) or die "Can't open memory file: $!\n"; print MEMORY "foo!\n";
|
---|