in reply to system & shell metacharacters
try system(qw[bar.pl -p 1234 -d], $xmldata). Calling system() with a list takes the shell out of play.
Not tested, but should work.