You may need to binmode your files, especially on Windows. Try open (my $MYFILE,'<:raw', ... and open (my $OUTPUT, '>:raw', ... (which is the equivalent of binmode $filehandle;).
Update: Added a bit more info.
In reply to Re: corruption of jpg written and retrieved from sqlite
by haukex
in thread corruption of jpg written and retrieved from sqlite
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |