Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: Re: Re: Zero Padding to the Right of the Decimal

by boo_radley (Parson)
on Jan 15, 2004 at 20:54 UTC ( #321668=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re: Zero Padding to the Right of the Decimal
in thread Zero Padding to the Right of the Decimal

you'll never exit the loop that way, because you never modify $i.
You could use +=, though :

my $i=0; while ($i <=100){ printf("%3.2f\n",$i+=0.01); }


Comment on Re: Re: Re: Re: Zero Padding to the Right of the Decimal
Download Code
Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Zero Padding to the Right of the Decimal
by revdiablo (Prior) on Jan 15, 2004 at 21:54 UTC

    This thread is probably already too deep for anyone to care, but if I were doing this, I would do so thusly:

        printf "%3.2f\n", $_/100 for 0 .. 100*100;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://321668]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2015-07-29 04:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls