A continuation of this question, and probably an even more weird one.
Can I e.g. concatenate two regexes
using a sub
?
(Of course, I understand, how to do it with a regex
)
The following code is totally wrong, but I hope it can explain what I want to do:
my Regex sub s12 ( $c, $v) {
return / <{$c}> <{$v}> /
}
my regex consonant { <[a .. z] -[aeiou]> }
my regex vowel { <[aeiou]> }
my regex open_syllable { &s12( &consonant, &vowel ) }
"bac" ~~ m:g/ <open_syllable> /;
say $/; # should be 'ba'