The list repetition operator (xx
) evaluates the list every time it is repeated. For example,
my @input = get() xx 5;
will evaluate to the first 5 lines of STDIN. Is there any way I can repeat just the value of the element 5 times, rather than evaluating it each time? Currently, I've been assigning it to a variable, then repeating it, but it seems a bit cumbersome that way.
my $firstLine = get();
my @firstlineRepeated = $firstLine xx 5;
Is there a prefix or something that lets me do it in one statement?