Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Tux
Created April 10, 2021 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tux/110e7b8e266b5f5d900b8d0d060018e4 to your computer and use it in GitHub Desktop.
Save Tux/110e7b8e266b5f5d900b8d0d060018e4 to your computer and use it in GitHub Desktop.
```
use v6;
class c {
has Str $.foo is rw = "a";
method bar (Str $s) {
return $s ~~ / $!foo /;
}
method bux (Str $s) {
my $foo = $!foo;
return $s ~~ / $foo /;
}
}
c.new.bar("baz").perl.say;
c.new.bux("baz").perl.say;
```
->
```
===SORRY!=== Error while compiling /pro/3gl/CPAN/Text-CSV6/issue-3430.pl
Attribute '$!foo' not available inside of a regex, since regexes are
methods on the Cursor class. Consider storing the attribute in a
lexical, and using that in the regex.
at /pro/3gl/CPAN/Text-CSV6/issue-3430.pl:7
------> return $s ~~ / $!foo⏏ /;
expecting any of:
infix stopper
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment