For starters i suggest reading this node
use cgi or die; on why that cgi-lib.pl line is a
bad thing. The next thing i see right off the bat is this line:
$file = FORM{'file'}; which should read
$file = $FORM{'file'}; I can't really test it becaue I dont have that cgi-lib file on my system (another good reason on use Std modules).