Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: for loop with float

by gloryhack (Deacon)
on Jul 24, 2008 at 22:47 UTC ( [id://699984]=note: print w/replies, xml ) Need Help??


in reply to for loop with float

Answering the question as asked, the answer is yes:
#!/usr/bin/perl use warnings; use strict; for (my $i = 0 ; $i < 9 ; $i = sprintf("%.1f", $i + 0.1)) { print "$i\n"; }

Although ikegami's answer is probably what you want.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found