in reply to Object Label Badly Formatted

I fixed the problem by changing:
while (<$pdf_name>){ $pdf .= $_; }

to:
$pdf = do {local($/) ; <$pdf_name> };

but I don't quite understand why that fixes the problem. Any explanation would really be appreciated.
Thanks!
--TWH

Replies are listed 'Best First'.
Re^2: Object Label Badly Formatted
by Tanktalus (Canon) on Mar 05, 2005 at 15:35 UTC

    I'm not sure that while (<$pdf_name>) works properly in binmode. You should be using read or sysread. In other words, don't read line-by-line when you've just told perl that it's a binary file. The second (new) code snippet doesn't read by line - it slurps the entire file as-is, with no translation. To get your while to work, just set local $/ = \1024 to read in 1024-byte chunks.