in reply to Variable variable names

You're not alone in wanting to do this. Almost every time, though--and I'm pretty sure this applies to you--people want to do this for the wrong reason.

Here's why you shouldn't do this: Part 1, Part 2, and Part 3.

And here's what you should do: use a hash or something similar. You have the right idea using $query->param, then grabbing the variables that you need to match based on a pattern. Instead of creating *variables* with those matched names, add entries to a hash.