in reply to What is the character for end of string in template Toolkit?

[% "Blah Blah," | remove(',$') %]
should work as well.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: What is the character for end of string in template Toolkit?
by Anonymous Monk on Jan 16, 2009 at 06:20 UTC
    Thanks guys! You are right. However, my actual program has this in a string variable and it doesn't work if I have it like this:
    [% foo = 'Blah blah,' %] [% foo | replace(',$', '') %]

    Any idea why? Appreciate the help!
      Not true. It works fine.
      use Template qw( ); my $template = Template->new(); my $input = <<'__EOI__'; [% foo = 'Blah blah,' %] [% foo | replace(',$', '') %] __EOI__ $template->process(\$input) or die $template->error();
      Blah blah
        Duhhh!!!! Thanks everyone! I had an whitespace after the comma:(( Works fine now!