in reply to redirect stream from wirte; to $string

Thank you all My code :
format SIMPLE_TOP= ______________________________________________________________________ +_ @||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| "TITLE" ______________________________________________________________________ +_ @|||||||||||||||||... |@||||||||... @||||||||... |@||||||||||||||||||. +.. "Variable1","Variable2","Variable3","Variable3" ______________________________________________________________________ +_ . format SIMPLE= @<<<<<<<<<<<<<<<<<... |@||||||||... @||||||||... |@||||||||||||||||||. +.. $varible, $varible, $varible, $varible ______________________________________________________________________ +_ .
and I am using write; to print it in the output. I found in documentation :
use Carp; sub swrite { croak "usage: swrite PICTURE ARGS" unless @_; my $format = shift; $^A = ""; formline($format,@_); return $^A; } $string = swrite(<<'END', 1, 2, 3); Check me out @<<< @||| @>>> END print $string;
but I don't have idea how it schould work, could you explain me, what mean << operator in that function, and how can I put more complicated formats, with TOP, and , FOOTER etc. ELISHEVA and DrHyde , I will try your tips, and check which will work for me better. thanks a lot for respond.

Replies are listed 'Best First'.
Re^2: redirect stream from wirte; to $string
by DrHyde (Prior) on Feb 01, 2011 at 11:52 UTC
    Eep! Formats! I haven't seen those in YEARS! In fact I've not seen them used for nearly two *decades*! You should consider them to be obsolete, and find another way of formatting your output. sprintf() is probably the weapon of choice.
      I just looking for way, to format somehow my output for easily reading. And I find those formats, I will try sprintf(),