Syntactic Confectionery Delight | |
PerlMonks |
Re^2: mutliplying each element of a list by the same numberby etj (Deacon) |
on Jun 06, 2022 at 02:42 UTC ( [id://11144427]=note: print w/replies, xml ) | Need Help?? |
perl -MPDL -e '$n=shift; print +(sequence($n)+1)*$n'
Turning the resulting ndarray into a flattened Perl list (with the list method) or structured Perl array (with the unpdl method) is left as an exercise for the reader.
In Section
Seekers of Perl Wisdom
|
|