Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Any downsides to this slurp idiom?

by Eily (Monsignor)
on Jun 22, 2018 at 12:54 UTC ( #1217187=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    open $fh, '<', $file or die $!; 
    process($fh) if is_valid($fh);
    
  2. or download this
    die $! unless open $fh, '<', $file; 
    is_valid($fh) and process($fh);
    
  3. or download this
    my $data;
    {
      local $/;
      open my $fh, '<', $file or die $!;
      $data = <$fh>;
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2023-03-26 08:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (63 votes). Check out past polls.

    Notices?