I just made perl panic

作者:   發佈於:  

Not sure why but try runing this code:

#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;

my $add3 = sub { $_ + 3 };
say map $add3 (1..30);

I see this panic message:

panic: ck_grep at /tmp/p.pl line 7.

One funny thing is, there no grep in there.

I'm not sure if I should use map function this way, but apparently I can't. To use named sub-routine as the first argument to map I'll have to say:

map { add3 } (1..30);

Where add3 is defined like this:

sub add3 { $_ + 3 }

Also, this causes syntax error:

map \&add3 (1..30);

sigh