in reply to How do I read an entire file into a string?

my $contents = do { local(@ARGV, $/) = $file; <> };

Also check out answers/discussions on SO, such as this one.

Replies are listed 'Best First'.
Re: Answer: How do I read an entire file into a string?
by BrowserUk (Patriarch) on Jun 15, 2016 at 11:37 UTC
    Stolen from brian d foy.

    Who stole it from Juerd.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
    In the absence of evidence, opinion is indistinguishable from prejudice. Not understood.