in reply to Not understanding while loop counting

You probably want
$count = 0; while (++$count < 10) { print "count is now $count\n"; }
But I would suggest using the exact loop style for this situation:
For ($count=1; $count<10; ++$count) { print "count is now $count\n"; }

Replies are listed 'Best First'.
Re^2: Not understanding while loop counting
by haukex (Archbishop) on Aug 10, 2020 at 15:09 UTC
    I would suggest using the exact loop style for this situation

    Or the perlish for my $count (1..9) { ... } (personally I reserve for (;;) for more complex cases like modifying the loop variable in the loop body, but TIMTOWTDI).

Re^2: Not understanding while loop counting
by LanX (Saint) on Aug 10, 2020 at 16:34 UTC
    Addendum: see also perlsyn#For-Loops

    Perl's C-style for loop works like the corresponding while loop; that means that this:
    for ($i = 1; $i < 10; $i++) { ... }
    is the same as this:
    $i = 1; while ($i < 10) { ... } continue { $i++; }

    NB I have to admit I practically never use continue ...

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery