neversaint has asked for the wisdom of the Perl Monks concerning the following question:
Now I want to uniformly distribute the elements of array above to this array:my @elems = ("x", "y", "z"); # array size may be varied (lesser or more than 3)
So that in the end I have this new array:my @tobepopulated = ("foo", "foo", "foo", "foo", "foo", "foo", "foo", +"foo", "foo", "foo"); # this can be more 10 elements
Is there a quick way to achieve that?my @new_array = ("foo-x", "foo-x", "foo-x", "foo-y", "foo-y", "foo-y", "foo-z", "foo-z", "foo-z", "foo-z");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Uniformly Populating an Array with Elements of Another Array
by roboticus (Chancellor) on Jul 28, 2007 at 10:53 UTC | |
|
Re: Uniformly Populating an Array with Elements of Another Array
by GrandFather (Saint) on Jul 28, 2007 at 10:49 UTC | |
|
Re: Uniformly Populating an Array with Elements of Another Array
by holli (Abbot) on Jul 28, 2007 at 10:58 UTC | |
|
Re: Uniformly Populating an Array with Elements of Another Array
by Skeeve (Parson) on Jul 28, 2007 at 15:47 UTC | |
|
Re: Uniformly Populating an Array with Elements of Another Array
by jettero (Monsignor) on Jul 28, 2007 at 10:57 UTC | |
|
Re: Uniformly Populating an Array with Elements of Another Array
by jdporter (Paladin) on Jul 29, 2007 at 13:37 UTC |