Maybe I'm just old fashioned (or I'm not paying enough attention), but I don't quite understand why this:
use File::Slurp; # ... my $file_data = read_file( 'file.name' );
is so much better than this:
my $file_data = do { local $/; open(I,'file.name'); <I> };
or why this:
use File::Slurp; #... my @lines = read_file( 'file.name' );
is better than this:
open( I, 'file.name' ); my @lines = <I>;
I realize that the man page for File::Slurp covers a lot more than that, but it doesn't seem as though it really adds all that much in terms of simplifying things that are already pretty easy just using unadorned functions that are already in common use (setting $/, using binmode, etc). And it doesn't seem to help much in terms of providing any extra layer of OS-independence.

So if the previous replies provide what you need in order to install the module, and you really want to do that, then good, go that way and be glad. But if you still have problems trying to use the module, look up the "fundamentals" on the things you really need to do -- it won't be that hard to work out a solution without the using module.


In reply to Re: slurp::file by graff
in thread slurp::file by drum1981

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.