Skip to Content
Perl 6 Deep Dive
book

Perl 6 Deep Dive

by Andrew Shitov
September 2017
Beginner
402 pages
9h 52m
English
Packt Publishing
Content preview from Perl 6 Deep Dive

List repetition operator

The operator xx is the list repetition operator. It is visually and ideologically similar to the x operator, but it works with lists. Consider the following example:

my @data = (10, 20);my @big_data = @data xx 100;say @big_data;

Here, the @data array will be repeated 100 times, and the @big_data variable will contain 100 copies of it.

Be careful not to accidentally mix the xx and x operators. If you use x instead of xx, then the compiler will not warn you, but instead, it will treat the argument as a string and perform string concatenation instead of repeating an array.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Perl Hacks

Perl Hacks

Chromatic, Damian Conway, Curtis Ovid Poe, Curtis (Ovid) Poe
Learning Perl 6

Learning Perl 6

brian d foy
Think Perl 6

Think Perl 6

Laurent Rosenfeld, Allen B. Downey
Pro Perl

Pro Perl

Peter Wainwright

Publisher Resources

ISBN: 9781787282049Supplemental Content