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

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!
  • Comment on Re^2: What is the character for end of string in template Toolkit?
  • Download Code

Replies are listed 'Best First'.
Re^3: What is the character for end of string in template Toolkit?
by ikegami (Patriarch) on Jan 16, 2009 at 06:32 UTC
    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!
        TT also knows how to trim your input.
        [% "Blah Blah, " | trim | remove(',$') %]

        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