Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Perl Loops

by vinoth.ree (Monsignor)
on Jun 29, 2013 at 20:34 UTC ( #1041511=note: print w/replies, xml ) Need Help??

in reply to Perl Loops

Hi stam1982

#!/usr/bin/perl use strict; use warnings; for (my $n = 2; $n < 21; $n += 2){ print "$n\n"; }
#!/usr/bin/perl use strict; use warnings; my @evens; my $n = 0; my $number_to_give_up_at = 21; # $#evens will contain value of index of last element in @evens array while ($n++ < $number_to_give_up_at and $#evens < 9){ push @evens, $n if $n % 2 == 0; } print join("\n", @evens);

All is well

Replies are listed 'Best First'.
Re^2: Perl Loops
by stamp1982 (Novice) on Jun 29, 2013 at 21:08 UTC
    Farang: How will you do that using the until/do-until loops?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1041511]
[stevieb]: I suppose I'll have to delete the 2.36 ver, then re-upload 2.36.1 and 2.36.2, and re-version 2.36 as 2.36.0
[Corion]: stevieb: Naah, I wouldn't delete versions from CPAN. Just up the version to 2.37 resp. 2.37.0 / 2.37.1 etc

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (12)
As of 2017-01-19 15:03 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (170 votes). Check out past polls.