Search code examples
perlcatalysttemplate-toolkit

Formatting and groupping float numbers


In a Perl Catalyst application, using Template-Toolkit, I print lists of floating numbers using a format:

<h4>[% price | format('%9.2f') %]</h4>

what formats correctly the numbers (ex. 2113.99) But, I would like to use digit groupping like 2 113.99. I read Template::Plugin::Number::Format but there is no word about digit groupping. How could achieve this?

KI


Solution

  • From the very top of documentation link you provided:

    Constructor Parameters

    The USE line accepts the following parameters, all optional, which define the default behavior for filters within the current Context:

    THOUSANDS_SEP
    

    character inserted between groups of 3 digits

    ......