sub x { my $coderef = shift; use Data::Dumper; Data::Dumper->Dump([$coderef],['coderef']); { my $file = 'hoho.txt'; $coderef->(); } } $sub = sub { print "$file.YYY" } x $sub;
I am told "not a CODE reference at line 9" (the line where I attempt to dereference what I had hoped would be a code reference.
In reply to passing and processing code references by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |