##
sub callback {
my $coderef = shift;
my @args = @_;
sub { $coderef->(@args) }
}
sub short_but_wrong { sub { shift->(@_) } }
sub foo { print "@_\n" }
my $mine = callback( \&foo, 1, 2, 3 );
my $yours = short_but_wrong( \&foo, 1, 2, 3 );
print "Mine: "; $mine->();
print "Yours: "; $yours->();
####
X: 1 2 3
Undefined subroutine &main:: called at cback line 7.
####
sub callback {
my ( $coderef, @args ) = @_;
sub { $coderef->( @args ) }
}