SPUG: double quotes vs printf

Michael R. Wolf MichaelRWolf at att.net
Thu Jun 21 23:18:31 PDT 2007

> If one wants to use more detailled format specs (e.g. %8.2f),
> variable expansion doesn't work unless the variable contains the
> formatted string.

Yup!  Perhaps you brought up a better example of why I like to separate the
how(presentation) from the what(data)....

my $line_item_fmt = 'Qty: %3d   Unit Price: $%7.2f    Extended Price:
print $line_item_fmt, $qty, $unit_price, $qty * $unit_price;

Michael R. Wolf
    All mammals learn by playing!
        MichaelRWolf at att.net

More information about the spug-list mailing list