Sorry for the late reply. Actually, no, I'm not sorry, I've been away for a few weeks, so it's actually not my fault. :-)
On Mon, 13 May 2002 13:04:43 +0200, Axel Rose wrote: >At 14:37 Uhr +0100 06.05.2002, Alan Fry wrote: >>open(IN, $f); > >Problem 1: >open() failes if a filename contains spaces. This is a very >common problem. Even Net::FTP didn't work. >Everybody opening files from the Desktop has to make this >experience. Then use the three argument open(). It's been added to Perl in order to solve this very problem, for one. It's rather new, I'm pretty sure it wasn't in perl 5.004, but it *is* available in 5.6, so with the newest MacPerl, you should be able to use it. The way it works, is that instead of using a combined string with file name and opening mode, you now have them in separate arguments: open(IN, "<", $f); Simple, isn't it? >>my $info_start = index($str, "$info_block 0 obj"); > >Problem 2: >index() will also find blocks which look like the right one >but are really the wrong objects ("14 0 obj", "4 0 obj"). Then use a regex. No need to use pos() any more to find out where the match starts, $-[0] can tell you it is. $info_block should contain a number, shouldn't it? my $info_start = $str =~ /\b$info_block 0 obj\b/ && $-[0]; I think this will even be plug-in compatible with your original solution. -- Bart.