Skip to content

Instantly share code, notes, and snippets.

@tene
Created March 3, 2011 09:21
Show Gist options
  • Save tene/852550 to your computer and use it in GitHub Desktop.
Save tene/852550 to your computer and use it in GitHub Desktop.
demo of devel declare prototype
use fn;
use 5.010;
fn foo ($f, $a; $extra) {
say "going to call with ($a)";
$f->($a);
if (defined($extra)) {
say "got extra: $extra";
}
say "done with call";
}
foo( fn ($msg) {
say "bar: $msg";
}, "lol");
[sweeks@sweeks-laptop dd]$ perl f.pl
going to call with (lol)
bar: lol
done with call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment