That's a tricky question mate....technically you can access an object entirely based on naming syntax, but it's a little bit difficult (can't exactly remember how)....
A slightly more easy solution would be this:
for j in 1 to selection.count do
selection[j].parent = $object
To use the script, select all the object that you want to parent to $object, then run the script