Aim9b has asked for the wisdom of the Perl Monks concerning the following question:

I was wondering how I can get comma's into amounts that are greater than 999.99. The formats look like this. The period is no problem, but a comma inserted treats the mask like 2 separate fields.

format Dept_SubTotal = ------ -------- ---------- -- +------------ @### @###### @#####.## $ +@########.## $prevdept, $dptqty, $dptwgt, + $dptamt .

Replies are listed 'Best First'.
Re: Formatted Dollar amounts
by NetWallah (Canon) on Feb 09, 2015 at 04:00 UTC
    From the "perlform" documentation:

    NOTES
           Because the values line may contain arbitrary expressions (for at fields, not caret fields), you can farm out more sophisticated processing
           to other functions, like sprintf() or one of your own.  For example:
    
               format Ident =
                   @<<<<<<<<<<<<<<<
                   &commify($n)
               .
    
    
    
    and for a discussion on the implementation of "commify", see this thread.

            "You're only given one little spark of madness. You mustn't lose it."         - Robin Williams