in reply to HoH problem

You would also do well to avoid using Perl keywords as your varialbe names (or filehandles in this case). It will be extremely confusing when Perl starts spitting out warnings and errors at you.

I am referencing: open (open,"<upload_profile/$file") or die $!;

ikegami fixed this without pointing it out (along with fixing other things). Try using more descriptive filehandles or variable names and stay away from Perl specific keywords for them.