Skip to content

Instantly share code, notes, and snippets.

@hjkp
Created October 29, 2008 00:49
Show Gist options
  • Save hjkp/20569 to your computer and use it in GitHub Desktop.
Save hjkp/20569 to your computer and use it in GitHub Desktop.
def foo(*bar, &baz)
puts foo.inspect
baz.call
end
foo(:one, :two, :three) { puts 'monkey!' }
# >STDOUT> [ :one, :two, :three ]
# >STDOUT> monkey!
sub foo {
my @bar = @_;
my $baz = pop(@bar);
print Data::Dumper->Dump([@bar]);
&$baz;
}
foo("one", "two", "three", sub { print "monkey!" });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment