# New Ticket Created by Vasily Chekalkin
# Please include the string: [perl #56612]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=56612 >
Hello.
Simple test case for closures shows accessing wrong lexpad.
sub times($a,$b) {
$a * $b;
};
sub divide($a,$b) {
$a / $b;
}
sub make_op($op) {
sub($a,$b) { $op($a,$b) }
};
my $t = make_op(×);
say $t(21,2);
my $div = make_op(÷);
say $div(42,2);
# expected result is
# 42
# 21
#
# actual is
# 42
# 84
--
Bacek