I'm having some trouble using the &?SUB variable in a subroutine declared with the -> operator. The following code results in an error about &?SUB being undefined:

my $s = -> $count {
  if $count < 10 {
    say $count;
    &?SUB($count + 1);
  }
};

$s(1);

If I change to either a named sub (sub foo($count) { ... }), or an anonymous sub declared with the sub keyword (my $s = sub ($count) { ... } ) then it works fine, it's only with the -> that it doesn't work.

Is there something wrong with my code, or is this an actual bug?

-garrett

Reply via email to