I'm trying to figure out what the $empid and @array do.
Why don't you split out the statements so you can diagnose what's going on better? Or use an Array of Arrays?
Also, do you have to put another set of parens around the list you created with @empid and @array, e.g.