[aclug-L] Re: Formatting numbers in Perl!
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
if nothing else, you *could* calculate the length of the longest one, then
pad the others accordingly... i remember doing that back in pascal! : ^ )
--
Jesse Kaufman | WebSurf Internet Access
Administration / Web Development | www.websurf.net
glandix@xxxxxxxxxxx | Ph: 316.945.7873
www.linuxfreak.com/~glandix | Fax: 316.946.9944
--
<<< Vim is a REAL man's text editor. I don't know why anyone else would
even bother with sissy programs like emacs, or even worse... pico! >>>
On Fri, 20 Oct 2000, Mohammad Islam wrote:
> Steven Saner wrote:
> >
> > You can use the sprintf, which is the same as printf except that it
> > will print to a string. So something like:
> >
> > $sub_total = sprintf "%.2d", $price * $quantity;
> >
> Thanks. Yea i have found some info about sprintf and alreaduy using it.
> Now how about left or right justifying? Say I have the following..
>
> 99.99 124.50 6780.98
>
> I want them to line up like this:
>
> 99.99
> 124.50
> 6780.98
>
> Can i do this with sprintf?
>
> Thanks.
>
> Moe
>
> -- This is the discussion@xxxxxxxxx list. To unsubscribe,
> visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
>
-- This is the discussion@xxxxxxxxx list. To unsubscribe,
visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
|
|