The optimizer can lower lexical variables into local variables.
When it does so, it keeps track of this so that it can give you this error
message.
The `given` block and the `when` blocks are optimized away.
If you move the first `$a` declaration to inside the `given` block the
error goes away.
Yesterday I created a new when clause in an existing working program, which
worked fine, but today when I came to exercise another previously working
when clause it was broken.
The golfed version...
my $a = 41;
given 6 {
when 5 {
my $a;
}
when 6 {
say $a + 1;
}
}