On Sat, Jul 3, 2010 at 4:00 PM, Dr.Ruud <rvtol+use...@isolution.nl> wrote: > marcos rebelo wrote: > >> There was some discussion in the recipe, so I rewrite it: >> >> >> http://sites.google.com/site/oleberperlrecipes/recipes/05-io/02-slurp-a-file >> >> Please comment this ore any other recipe. >> >> Remember that you may also propose some other useful recipe. > > There are too many things that I don't like. > You best also add links to any discussion here on that page. > > I'll comment on 2 more things: > > my $body = do { local $/; readline $FH }; > > You should also benchmark this variant: > > my $body; { local $/; $body= <$FH> } > > (yes, those are the 2 things :) > > -- > Ruud > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > >
I consider this ones at the time Since the difference in performance is +-1% from one to the others, I decided to let the most readable one (at least in my opinion). I even consider to delete the read_file_in_do, but it is incredible how many times you may find it in short scripts or even in the web. Notice also That I'm not suggesting the fastest solution, but most readable/maintainable one. With the package File::Slurp Best Regards Marcos Rebelo -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org Webmaster of http://sites.google.com/site/oleberperlrecipes/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/