Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Conditions and Function call

by KPeter0314 (Deacon)
on Feb 23, 2004 at 18:10 UTC ( [id://331168]=note: print w/replies, xml ) Need Help??


in reply to Conditions and Function call

Not really shorter, but possibly cleaner depending on what the logic you were intending:
if(($ma == 1) && ($sy == 1)) { SWITCH: { $al == 1 && do { print "\nshow some text.\n"; notify(); last SWITCH; }; $tr == 1 && do { print "\nnext data info\n"; notify(); last SWITCH; }; $ge == 1 && do { print "\nnew info here\n"; notify(); last SWITCH; }; }; };
I will say that until you get more comfortable with Perl or are really trying for Perl golf, then I would suggest readablity over short.

-Kurt

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-18 01:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found