sub make_closure { my ($x) = @_; return sub { $x }; } my $c1 = make_closure("a"); my $c2 = make_closure("b"); say $c1->(); # a say $c2->(); # b