> I want to format the output of my database query.
> Current code
> while (@row =$sth->fetchrow() ) {
> print join(',',@row);
> }
>
> Results
> 1.38, .0396,.0076
>
> Desired Results
> 1.38, 0.0396, 0.0076
Frank,
It's tough for me to be sure exactly what you are wanting for formatting, so I would
recommend
reading
perldoc -f sprintf
In the meantime, this will get what you have asked for:
my @nums = qw/ 1.38 .0396 .0076 /;
printf("%.2f, %.4f, %.4f", @nums);
Cheers,
Curtis "Ovid" Poe
=====
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]