I'm trying to write all new Perl code in Perl 6.  One thing I need is
the equivalent of the Perl 5 qr// and, following Perl 6 docs, I've
come to use something like this (I'm trying to ignore certain

# regex of dirs to ignore
my regex dirs {
  \/home\/user\/\.cpan |

for "dirlist.txt".IO.lines -> $line {
  # ignore certain dirs
  if $line ~~ m{<dirs>} {

My question: Is there a way to have Perl 6 do the required escaping
for the regex programmatically, i.e., turn this:

my $str = '/home/usr/.cpan';

into this:

my regex dirs {



Best regards,


Reply via email to