On Fri, 30 Jan 2009, Eric Lease Morgan wrote:

> Is there any way I can make my Perl wrapper for yaz-marcdump, below, more
> efficient?


> For extra credit, is there anyway I can optimize m2u? For example, is there
> anyway to get rid of the while loop and slurp up yaz-marcdump's output in
> one go?

It might be faster to process multiple files at once, so you don't have 
the overhead of perl starting up each time.  For the while loop, use:

 	my $r = do { local $/ = undef; <C> };

(unset the end-of line marker, then read it in one pass, the 'do' block 
keeps the change of end of line marker from affecting anything else)