in reply to Re^5: IE vs. Firefox : Can't use an undefined value as a HASH reference error
in thread IE vs. Firefox : Can't use an undefined value as a HASH reference error
I was trying to make the code more reusable and so re-wrote the subroutine to pass the file name and the directory path, but it obviously doesn't work.## OLD CODE sub Store_Results{ my $data; my $mime = uploadInfo($File_Name)->{'Content-Type'}; open (STORAGE, ">$Directory/$File_Name") or die "Error: $Directory +/$File: $!\n"; if($mime !~ /text/){ binmode ($File_Name); binmode (STORAGE); } while( read($File_Name, $data, 1024) ){ print STORAGE $data; } close STORAGE; } ## NEW CODE #stores uploaded files sub storeFiles{ my($filename, $directory) = @_; #name subroutine variables my $data; my $mime = uploadInfo($filename)->{'Content-Type'}; open (STORAGE, ">$directory/$filename") or die "Error: $directory/ +$filename: $!\n"; if($mime !~ /text/){ binmode ($filename); binmode (STORAGE); } while( read($filename, $data, 1024) ){ print STORAGE $data;} close STORAGE; }
works, butmy $mime = uploadInfo($File_Name)->{'Content-Type'};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: IE vs. Firefox : Can't use an undefined value as a HASH reference error
by Roy Johnson (Monsignor) on Feb 24, 2005 at 20:15 UTC | |
|
Re^7: IE vs. Firefox : Can't use an undefined value as a HASH reference error
by dragonchild (Archbishop) on Feb 24, 2005 at 20:09 UTC | |
by hmbscully (Scribe) on Feb 24, 2005 at 20:29 UTC |