Skip to content

Instantly share code, notes, and snippets.

##https://stackoverflow.com/q/60365292/7270649
say "â" ~~ /\w/; # you have to have a space following the "a" with "^" for it to work
#「â」
say "�" ~~ /\w/; # without the space, the character doesn't look normal
#Malformed UTF-8 at line 1 col 6
say "â".chars; # looks like 2 chars, but it says 1 char
#1
say "â".comb.[0]; # strange, the pesky char makes the space precede the cursor as I type
#Raku (i.e. Perl6) "raku-regex-how-to-use-capturing-group-inside-lookaheads"
#examples with capture markers and 'doubled' capture markers:
say 'abc' ~~ / abc /;
#「abc」
say 'abc' ~~ / a <( b )> c/;
#「b」
say 'abc' ~~ / a <( (b) )> c/;
#「b」
# 0 => 「b」
class Foo1 {
has $!odd = 12;
has $!even = 24;
method AT-POS(\position) is rw {
position % 2 ?? $!odd !! $!even
}
}
say Foo1.new[10].VAR.name; # $!even
say Foo1.new[10].VAR.^name; #Scalar