in reply to How to duplicate every member of an array
@doubled = map { ($_) x 2 } @array
FWIW, you could of course also do
@doubled = (@array) x 2
but the order would be different.
a b c d a b c d
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to duplicate every member of an array
by soblanc (Acolyte) on Jul 28, 2022 at 13:27 UTC |