in reply to Re: I need some wisdom. How do I pack an array to a set length.
in thread I need some wisdom. How do I pack an array to a set length.
Though you're example is perfect, your wording is not. x works also on lists, not on arrays:
$ perl -E'@x=("a".."c");@y=@x x 3;say@y' 333 $ perl -E'@x=("a".."c");@y=(@x)x 3;say@y' abcabcabc $
That is why the extra parens are needed, otherwise the array would be evaluated in scalar context by x and hence returns its length.
|
|---|