Skip to content

Commit e509fc3

Browse files
author
Zefram
committed
clarify perlop description of binary "x"
[perl #132460]
1 parent 257296e commit e509fc3

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

pod/perldelta.pod

+4
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@ paragraph on the same topic in L<perldata>.
316316

317317
=item *
318318

319+
The description of the C<x> operator in L<perlop> has been clarified.
320+
321+
=item *
322+
319323
XXX Description of the change here
320324

321325
=back

pod/perlop.pod

+10-5
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,16 @@ operator is not as well defined for negative operands, but it will
330330
execute faster.
331331
X<%> X<remainder> X<modulo> X<mod>
332332

333-
Binary C<"x"> is the repetition operator. In scalar context or if the left
334-
operand is not enclosed in parentheses, it returns a string consisting
335-
of the left operand repeated the number of times specified by the right
336-
operand. In list context, if the left operand is enclosed in
337-
parentheses or is a list formed by C<qw/I<STRING>/>, it repeats the list.
333+
Binary C<x> is the repetition operator. In scalar context, or if the
334+
left operand is neither enclosed in parentheses nor a C<qw//> list,
335+
it performs a string repetition. In that case it supplies scalar
336+
context to the left operand, and returns a string consisting of the
337+
left operand string repeated the number of times specified by the right
338+
operand. If the C<x> is in list context, and the left operand is either
339+
enclosed in parentheses or a C<qw//> list, it performs a list repetition.
340+
In that case it supplies list context to the left operand, and returns
341+
a list consisting of the left operand list repeated the number of times
342+
specified by the right operand.
338343
If the right operand is zero or negative (raising a warning on
339344
negative), it returns an empty string
340345
or an empty list, depending on the context.

0 commit comments

Comments
 (0)