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

Re: two statements in or

by davorg (Chancellor)
on Jun 26, 2009 at 10:50 UTC ( [id://775015]=note: print w/replies, xml ) Need Help??


in reply to two statements in or

Well, you could use do:

open my $fh, 'file' or do { something; something else; };

But that's getting a bit obscure, so I'd probably write something a bit more expressive.

if (!open my $fh, 'file') { something; something else; }

Or

unless (open my $fh, 'file') { something; something else; }
--

See the Copyright notice on my home node.

Perl training courses

Log In?
Username:
Password:

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

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

    No recent polls found