Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How do I read an entire file into a string?

by reisinge (Hermit)
on Jun 15, 2016 at 10:54 UTC ( [id://1165710]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1165710]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-19 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found