The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

use v5.10;
use strict;
my $list_nonempty = qr{
<List>
<rule: List>
\( <[Value]>+ % (,) \)
<token: Value>
\d+
}xms;
my $list_empty = qr{
<List>
<rule: List>
\( <[Value]>* % <_Sep=(,)> \)
<token: Value>
\d+
}xms;
while (my $input = <>) {
my $input2 = $input;
if ($input =~ $list_nonempty) {
### nonempty: $/{List}
}
if ($input2 =~ $list_empty) {
### empty: $/{List}
}
}