How can I generate an array in Perl with 100 random values, without using a loop?
I have to avoid all kind of loops, like \"for\", foreach\", while. This is my exerc
While the copy'n'paste examples are novel and the map/foreach alternatives have also been mentioned, I think one approach that has not been discussed is recursion. Using recursion (an implicit loop) would need method calls and a simple 'if' statement: no for/grep/map/etc. It could be side-effecting or side-effect free.
Since this is homework, I will leave the implementation to the poster.
Happy coding.
BTW: Nobody has posted a regular expression solution yet ;-)
It's nice to see some even more innovative solutions! :-)