Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Any downsides to this slurp idiom? (updated)

by haukex (Bishop)
on Jun 30, 2018 at 19:34 UTC ( #1217663=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $data = do { open my $fh, '<', $file or die "$file: $!";
        local $/; <$fh> };
    
  2. or download this
    my $data = do { open my $fh, '<:raw:encoding(UTF-8)', $file
        or die "$file: $!"; local $/; <$fh> };
    
  3. or download this
    my $data; { open my $fh, '<', $file or die "$file: $!";
        local $/; $data = <$fh> };
    
  4. or download this
    my $data = do { local (*ARGV,$/); @ARGV=$file; <> };
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2021-09-27 05:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?