variable $0

Documentation for variable $0 assembled from the following types:

variable $/

From $/

($/) variable $0

$/ can have positional attributes if the Regex had capture-groups in it, which are just formed with parentheses.

'abbbbbcdddddeffg' ~~ / a (b+) c (d+ef+) g /;
say $/[0]; # OUTPUT: «「bbbbb」␤» 
say $/[1]; # OUTPUT: «「dddddeff」␤» 

These can also be accessed by the shortcuts $0, $1, $2, etc.

say $0# OUTPUT: «「bbbbb」␤» 
say $1# OUTPUT: «「dddddeff」␤» 

To get all of the positional attributes, any of $/.list, @$/, or @() can be used.

say @().join# OUTPUT: «bbbbbdddddeff␤»