Okay, I'll check out XML::Twig; looks cool!
I did find the actual root of the problem, though: on the line where I get the output from qstat, I do:
$qstat = `qstat -u \* -ext -xml -s r -F`;
That backslash in the command is getting escaped and not being sent to the operating system, so the command wasn't even outputting anything.
*doh*