Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

x

Repeats a string a given number of times.

Pops the repeat count (right operand) and the string (left operand) from the stack. Returns a new string consisting of the left operand concatenated with itself COUNT times. A count of zero or less produces an empty string. Inf and NaN counts are treated as zero (matching perl5).

Synopsis

$line = '-' x 80;          # 80 dashes
$pad  = ' ' x $width;
$s    = 'ab' x 3;          # "ababab"

See Also

x, perlop