Just another way to do it:
my $wall_height = shift || 50; my $stripe = shift || 11; my @stripes = grep { $_ % $stripe == 0 } 1 .. $wall_height; print "@stripes\n";
If perchance you don't want a stripe painted on the very top course of your wall, just change
1 .. $wall_height to 1 .. $wall_height - 1
In reply to Re: Building an array, "stripes on a wall"
by Not_a_Number
in thread Building an array, "stripes on a wall"
by redmustang
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |