in reply to write from filehandle to variable
use 5.008000; # Requires Perl 5.8.0 or higher my $var = ''; open(my $fh, '>', \$var) or die("Unable to open mem file: $!"); print $fh 'moo!'; print(length($var), "\n"); # Prints '4'.
In earlier versions, IO::Scalar might do the trick.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: write from filehandle to variable
by Anonymous Monk on Nov 21, 2005 at 17:56 UTC | |
by chibiryuu (Beadle) on Nov 21, 2005 at 20:20 UTC | |
by ikegami (Patriarch) on Nov 21, 2005 at 18:01 UTC |