Print

Print


On Fri, Jan 30, 2009 at 4:12 PM, Eric Lease Morgan <[log in to unmask]> wrote:

>
>    # run yaz and trap the output
>    open ( C, "$y$f |" ) or die "Can't open converter: $!\n";
>    while ( <C> ) { $r = $_ }
>    close C;
>
>
> 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?


You can replace the while loop with perl's usual slurp idiom:

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

Explained here:
http://www.perlmonks.org/?node_id=287647

--jay