in reply to @CGI $q->upload() doesnt work properly
See this and follow the links deep, it discusses same problems your code has (in addition to what Eliya said)
The cgi documentation says $CGI::DISABLE_UPLOADS not $main::q::DISABLE_UPLOADS
See also Tutorials: Variable Scoping in Perl: the basics, Coping with Scoping , and start making subs/passing them arguments
In Section
Seekers of Perl Wisdom