[ABE.pm] printing to a variable
Ricardo SIGNES
rjbs-perl-abe at lists.manxome.org
Fri May 19 17:51:09 PDT 2006
* "Faber J. Fedor" <faber at linuxnj.com> [2006-05-19T14:31:37]
> Can I print TO a variable?
>
> I want to use Perl's report formatting capability to generate text
> output but I want to store the output in a variable as opposed to
> printing to a file.
by "report formatting" do you mean "format"? Format is the devil. Avoid it.
Consider using a real templating system, like Template.pm, instead.
...but yet. You need to create a filehandle that can write to a scalar.
use IO::String;
my $string;
my $io = IO::String->new($string);
print {$io} "This will be appended to the string.";
--
rjbs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060519/916f6b74/attachment.bin
More information about the ABE-pm
mailing list