in reply to Passing results of a substitution to a function

Yes, there is a way you can pass a regex -- as a scalar -- around. See qr// in perlop.
  • Comment on Re: Passing results of a substitution to a function