Balanced brackets: Difference between revisions
Content added Content deleted
Line 3,394: | Line 3,394: | ||
===String munging=== |
===String munging=== |
||
Of course, a Perl 5 programmer might just remove as many inner balanced pairs as possible and then see what's left. |
Of course, a Perl 5 programmer might just remove as many inner balanced pairs as possible and then see what's left. |
||
{{works with|Rakudo|2015.12}} |
|||
<lang perl6>sub balanced($_ is copy) { |
<lang perl6>sub balanced($_ is copy) { |
||
Nil while s:g/'[]'//; |
|||
$_ eq ''; |
$_ eq ''; |
||
} |
} |