Convert php to perl -- writing xml

i need to take a simple php script that writes xml and convert it to a perl script

can anyone who knows perl give me a hand?

<?php
$filename = “/home/users/web/bbbb/xxxxx/htdocs/data/collection.xml”;
$raw_xml = file_get_contents(“php://input”);

print $raw_xml;

$fp = fopen($filename, “w”);
fwrite($fp,$GLOBALS[‘HTTP_RAW_POST_DATA’]);
fclose($fp);
?>

thanks…