in reply to How would you do this?

I'd start by removing all the unnecessary backslashes, then look at the command string again, and see what it actually does.

After that, I may rewrite it into pure Perl, but that sounds too much like work - if it works as it, why bother?

But lose the redundant backslashes. That alone would remove more than half of the uglyness factor.

Oh, and for the next time, come up with a better title.