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?