hello all

please see the code below
i'm a newbie in perl.

Code:
use File::stat;

print "Content-type: image/jpg \n\n";
#print "Content-type: text/html\n\n";

my $buffer;
my $file = "1.jpg";
my $length = stat($file)->size;
#print "Content-length: $length \n\n"; 
open FN,$file;
binmode FN;
read FN, $buffer, $length;
print $buffer;
close FN;
i'm trying to open a jpg file and trying to send it to browser.
but the file arrives in browser as correpted (?).

(server indigoperl, apache 1.3.26,mod_perl 1.25 )

Pls help
thanks