in reply to How to route a format into a variable

Just a question,
if you want your formated output alltogether in on variable, why don't you use  sprintf and concat all the lines together in one string, or maybe one array ?

-----------------------------------
--the good, the bad and the physi--
-----------------------------------

Replies are listed 'Best First'.
Re: Re: How to route a format into a variable
by ppm (Novice) on Feb 12, 2003 at 17:51 UTC
    >> why don't you use sprintf

    i don't know how to do this with formats ;o) do you have a solution?

      There is an example of a sprintf-like function emulating write in the Perl Formats documentation, reproduced below for convenience.

      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;

          --k.


        @Kanji:

        yes, i saw this topic .. but i don't understand how to use this for my e.g. any help?

        @Kanji:

        yes, i saw this topic . but i've no idea how to do this for my e.g. do you have any ideas?