($foo, $bar) = incrementByOneAndTwo(42); ($baz, $quux) = incrementByOneAndTwo(0); $\="\n"; print $foo->(); print $bar->(); print $quux->(); print $foo->(); print $baz->(); print $bar->(); print $quux->(); sub incrementByOneAndTwo { my $shared_state = shift; return (sub{$shared_state+=1}, sub{$shared_state+=2}); }