File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -1283,7 +1283,7 @@ An interpolated array:
1283
1283
is matched as if it were an alternation of its literal elements. Ordinarily it
1284
1284
matches using junctive semantics:
1285
1285
1286
- / [ @cmds[0] | @cmds[1] | @cmds[2] | ... ] /
1286
+ / [ $( @cmds[0]) | $( @cmds[1]) | $( @cmds[2]) | ... ] /
1287
1287
1288
1288
1289
1289
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
1294
1294
1295
1295
is equivalent to
1296
1296
1297
- / [ @cmds[0] || @cmds[1] || @cmds[2] || ... ] /
1297
+ / [ $( @cmds[0]) || $( @cmds[1]) || $( @cmds[2]) || ... ] /
1298
1298
1299
1299
Or course, you can also
1300
1300
1301
1301
/ | @cmds /
1302
1302
1303
1303
to be clear that you mean junctive semantics.
1304
1304
1305
+ Note the usage of $(...) to prevent the subscripts from being parsed as
1306
+ regex syntax rather than an actual subscript.
1307
+
1305
1308
Since C<$x> is interpolated as if you'd said C<"$x">, if C<$x> contains
1306
1309
a list, it is stringified first. To get alternation you must use the
1307
1310
C<@$x> or C<@($x)> form to indicate that you're intending the scalar
You can’t perform that action at this time.
0 commit comments