package DownloadUtils; use strict; use vars '$mech'; sub get_mech { WWW::Mechanize->new(); }; $mech = get_mech(); sub get_file { $mech->get("$url", ':content_file' => "$file"); }; 1;