Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Building an array, "stripes on a wall"

by Not_a_Number (Parson)
on Jun 12, 2011 at 12:44 UTC ( #909299=note: print w/ replies, xml ) Need Help??


in reply to Building an array, "stripes on a wall"

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2016-06-30 04:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (388 votes). Check out past polls.