in reply to Can Perl do this...?

Perl will handle that job fine. Just make sure to carefully check the input you get from the client, as it's really easy to allow bad characters through. Be sure your Perl shabang (#!) line has the -T (taint) switch, which will force you to check your input before doing anything particularly dangerous with it (note that this won't stop you from doing dangerous things if you really try, but it will stop some common mistakes).

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated