Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[6.d] Document $()/@()/%() are no longer magical in 6.d
  • Loading branch information
zoffixznet committed Sep 20, 2018
1 parent 3ee141e commit f55804f
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions doc/Language/variables.pod6
Expand Up @@ -1032,6 +1032,16 @@ say $/;
# textnode => 「some text」␤»
=end code
To get a stringified version of the L<Match> object, simply use the
L<prefix ~ operator|https://docs.perl6.org/routine/~.html#(Operators)_prefix_~>.
In 6.c language, you can use C<$()> shortcut (no spaces inside the parentheses).
'test' ~~ /.../;
say ~$/; # OUTPUT: «tes␤»
# 6.c language only:
say $(); # OUTPUT: «tes␤»;
=head4 X«Positional attributes|variable,$0;variable,$1;variable,@()»
C<$/> can have positional attributes if the L<Regex|/language/regexes> had
Expand All @@ -1046,9 +1056,12 @@ These can also be accessed by the shortcuts C<$0>, C<$1>, C<$2>, etc.
say $0; # OUTPUT: «「bbbbb」␤»
say $1; # OUTPUT: «「dddddeff」␤»
To get all of the positional attributes, any of C<$/.list>, C<@$/>, or
C<@()> can be used.
To get all of the positional attributes, you can use C<$/.list> or C<@$/>. In 6.c language,
you can also use the C<@()> shortcut (no spaces inside the parentheses).
say @$/.join; # OUTPUT: «bbbbbdddddeff␤»
# 6.c language only:
say @().join; # OUTPUT: «bbbbbdddddeff␤»
=head4 X«Named attributes|variable,$<named>;variable,%()»
Expand All @@ -1065,9 +1078,12 @@ These can also be accessed by the shortcut C«$<named>».
say $<punctuation>; # OUTPUT: «「....」␤»
say $<final-word>; # OUTPUT: «「see?」␤»
To get all of the named attributes, any of C<$/.hash>, C<%$/>, or C<%()> can
be used.
To get all of the named attributes, you can use C<$/.hash> or C<%$/>. In 6.c language, you
can also use the C<%()> shortcut (no spaces inside the parentheses).
say %$/.join; # OUTPUT: «"punctuation ....final-word see?"␤»
# 6.c language only
say %().join; # OUTPUT: «"punctuation ....final-word see?"␤»
X<|error variable>
Expand Down

0 comments on commit f55804f

Please sign in to comment.