Skip to content

Commit 7316137

Browse files
committed
try to resolve #40
1 parent 4930c60 commit 7316137

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

S05-regex.pod

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ An interpolated array:
12831283
is matched as if it were an alternation of its literal elements. Ordinarily it
12841284
matches using junctive semantics:
12851285

1286-
/ [ @cmds[0] | @cmds[1] | @cmds[2] | ... ] /
1286+
/ [ $(@cmds[0]) | $(@cmds[1]) | $(@cmds[2]) | ... ] /
12871287

12881288

12891289
However, if it is a direct member of a C<||> list, it uses sequential
@@ -1294,14 +1294,17 @@ you can put C<||> before the first member of an alternation, hence
12941294

12951295
is equivalent to
12961296

1297-
/ [ @cmds[0] || @cmds[1] || @cmds[2] || ... ] /
1297+
/ [ $(@cmds[0]) || $(@cmds[1]) || $(@cmds[2]) || ... ] /
12981298

12991299
Or course, you can also
13001300

13011301
/ | @cmds /
13021302

13031303
to be clear that you mean junctive semantics.
13041304

1305+
Note the usage of $(...) to prevent the subscripts from being parsed as
1306+
regex syntax rather than an actual subscript.
1307+
13051308
Since C<$x> is interpolated as if you'd said C<"$x">, if C<$x> contains
13061309
a list, it is stringified first. To get alternation you must use the
13071310
C<@$x> or C<@($x)> form to indicate that you're intending the scalar

0 commit comments

Comments
 (0)