Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^5: Floating point number counting script stuck in a loop

by dwu (Monk)
on Oct 25, 2007 at 08:51 UTC ( [id://647109]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Floating point number counting script stuck in a loop
in thread Floating point number counting script stuck in a loop

Tinyish (but most on perlmonks can do better than I):
#!/usr/bin/perl -w use strict; for (1..9) { print $_/10, "\n"; }
Does the same as the question asks - likely wouldn't have accomplished the aim of the exercise, which was probably to teach you about using == with floats, but well ;) See perlvar for explanation of $_

Replies are listed 'Best First'.
Re^6: Floating point number counting script stuck in a loop
by GrandFather (Saint) on Nov 16, 2007 at 21:48 UTC
    print "0.$_\n" for 1 .. 9;

    ;)


    Perl is environmentally friendly - it saves trees

      GrandFather++; # remind dwu to upvote when she has votes again


      dwu - Amused
Re^6: Floating point number counting script stuck in a loop
by Vonunov (Novice) on Oct 25, 2007 at 10:12 UTC
    Ha! Nice. Perl golf FTW?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-23 15:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found