Chas. Owens wrote:
If you have a recent enough version of Perl* you can say
open my $fh, "<", \$scalar
or die "could not attach a file handle to \$scalar: $!";
while (my $line = <$fh>) {
chomp($line);
#do stuff with $line
}
* 5.8 can do this, but I am not sure about 5.6.*
perldoc -f open
[ SNIP ]
Since v5.8.0, perl has built using PerlIO by default. Unless
you’ve changed this (i.e. Configure -Uuseperlio), you can open
file handles to "in memory" files held in Perl scalars via:
open($fh, ’>’, \$variable) || ..
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/