in reply to Picking a Template Engine/Method

Ya know... I think I misunderstood the question... I'm leaving my orig response tho

A response to the correct question I've included as a reply to this msg :-)
This is actually super-easy in perl... for instance -
@stuff = qw/here are words/; format STDOUT = @<<<<<<<<<<< BLAHBLAH @<<<<<<< BLAHBLAH @<<<<<<<<< $stuff[0], $stuff[1], $stuff[2] . write;
This would print:
here           BLAHBLAH   are       BLAHBLAH   words

Alternately, you could just put @stuff instead of listing each element of the array and get the same output.

Check out `man perlform` for more info.

Hope this helps,

  -Adam

Replies are listed 'Best First'.
Re^2: Picking a Template Engine/Method
by Adrade (Pilgrim) on May 10, 2005 at 22:29 UTC
    Since I misinterpreted the question, I thought I'd offer another reply... $form would hold the data loaded in from file. An array called @data would hold the stuff you want to load into the Xs. The following hacky way of doing a format is suggested by perlform.
    $form = <<"EOF"; XXXXX XXXXX XXXX XX XX XXXXX X XXXX XXXX XXX EOF @data = qw/one two three four five six seven eight nine ten/; $form =~ s/\bX/\@/sg; $form =~ s/X/</sg; my $totalcount = 0; my $format = "format STDOUT = \n"; foreach (split(/\n/,$form)) { $format .= $_."\n"; (@c) = (m/([@<]+)/g); $format .= '$data['.$totalcount++.'],' for 0..$#c; $format =~ s/,$//s; $format .= "\n"; } $format .= "."; eval $format; write;

    This would produce this output:
    one       two   thre
      fo fi     six
    s    eigh    nine   ten
    


    Hopefully having repented for my error, I hope that helps!

      -Adam