I have two PHP scripts which I would love to have them in a Perl version:

<?php
if ($_GET["bots"] == "nocrawl") {
$find = array
(
"&bots=nocrawl",
"?bots=nocrawl"
);
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.examplesite.com".str_replace($find, '', $_SERVER['REQUEST_URI']));
}
?>

and

<?php
if (!stristr($_SERVER['HTTP_USER_AGENT'], 'msnbot')) {
echo '<p class="optout"><a href="/mailing-list/index.php" title="Opt-out">Unsubscribe Newsletter</a>.</p>';
}
?>

can someone give me a hand please?

Thank you so much in advance.