ikegami's solution is simple and elegant, as well as being what I would probably use. But, for the sake of TIMTOWTDI, and to introduce a very handy module, let me suggest:
use List::MoreUtils qw(zip); my @orig = qw(1 33 45 66); my @doubled = zip @orig, @orig; print "@doubled\n";
TGI says moo
In reply to Re: How do I double up elements within an array?
by TGI
in thread How do I double up elements within an array?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |