in reply to Problems with uploading a file from a web form

If you want to read the whole file into a string, then you should read in one go instead of reading it piece by piece and growing the string. This is done by setting $/ to undef and reading from the filehandle. The standard idiom is:
my $test = do { local $/; <$filename> };