If you're using LWP::UserAgent and HTTP::Request, you can specify the HTTP_REFERER using HTTP::Request's header() method:
# set up the user agent...
$req = HTTP::Request->new(GET => 'http://www.example.com');
$req->header('Referer' => 'http://www.yahoo.com');
# make the request and so on...