$previouspage =$ENV{'HTTP_REFERER'}; ### i know this is not the best solution if ($previouspage =~ m/int/) { ##define scalars. $query = new CGI; $filename = $query->param("profile_data"); #read infilename of data open(OUTPUT, ">$filename"); binmode $filename; binmode OUTPUT; ($bytesread,$buffer,$total); while ($bytesread = read($filename,$buffer,1024) ) { $total += $bytesread; if ($bytesread > 10000000) { close(OUTPUT); unlink "$filename"; } print OUTPUT $buffer; } close(OUTPUT); }