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, you can use $/.list or @$/. In 6.c language, you can also use the @() shortcut (no spaces inside the parentheses).

say @$/.join# OUTPUT: «bbbbbdddddeff␤» 
 
# 6.c language only: 
say @().join# OUTPUT: «bbbbbdddddeff␤»