in reply to Re: displaying pdf
in thread displaying pdf

May i suggest replacing read with sysread, and 1024 with the value returned from (stat($file))[11]?

The reason for doing so is that read is already buffered, and you're buffering it a second time... You should avoid it as you probably don't need it, and read directly...
About the size - "11 blksize preferred block size for file system I/O " - to quote from perldoc -f stat

open FILE,$file or die "$!"; my $len = (stat($file))[11]; while (sysread FILE, my $data, $len){ syswrite STDOUT, $data };
Would be my code of choice.
print is also bufferred I/O, and in the family of read, write, readline, getc, eof, printf seek and tell. It is also bufferred. It may or may not be a good idea to use buffering for writing either. Probably the latter if you're on the same filesystem.

I think that the most commonly used buffer size in pipes is 4096 bytes, and there's probably a reason for it too.

-nuffin
zz zZ Z Z #!perl