in reply to FORMATS, filehandle and variables

Perhaps something like IO::Scalar is what you seek?

Replies are listed 'Best First'.
Re: Re: FORMATS, filehandle and variables
by duff (Parson) on Jan 06, 2004 at 16:11 UTC

    Or in newer perl's (5.8.0 or better I think) you could just open a handle to a scalar ref and write to it. Quick (untested) example:

    #!/usr/bin/perl format FOO = This is @||||||||||||| $foo . open(FOO,">", \$str) or die; for $foo (qw(foo bar baz)) { write FOO; } close FOO; print $str;