in reply to Re^2: Pass sub reference
in thread Pass sub reference

Which is to say (warning: semi-advanced topic, but not really all that scary): Use a closure. See tutorial Closure on Closures.