Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Being more Assert-ive with Perl

by muba (Priest)
on Sep 23, 2004 at 15:51 UTC ( [id://393235]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    # warn the user of the wrong input and return
    # false, leaving the calling routine dealing 
    # with things
    (defined($coin) && $coin == 25) || (warn("You must insert 25 cents"), 
    +return 0);
    
  2. or download this
    # warn the user of the wrong input and return
    # false, leaving the calling routine dealing 
    # with things
    (defined($coin) && $coin == 25) || return do {warn("You must insert 25
    + cents"); 0};
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-19 22:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found