Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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

by haukex (Archbishop)
on Jun 30, 2018 at 19:34 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2024-04-23 08:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found