Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Ternary operators: a hinderance, not a help

by fizbin (Chaplain)
on Aug 09, 2005 at 20:55 UTC ( [id://482426]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $numspells = ($doDeanStuff ? 1 : 0) 
                  + ($doSeamusStuff ? 1 : 0)
    ...
                  + ($doSeverusStuff ? 5 : 0); # it's really complicated
    
    print "Budget for this incantation is $numspells spells\n";
    
  2. or download this
    my $numspells = 0;
    $numspells += 1 if ($doDeanStuff);
    ...
    $numspells += 2 if ($doHarryStuff);  # Harry's stuff takes multiple sp
    +ells
    $numspells += 1 if ($doRonStuff);
    $numspells += 5 if ($doSeverusStuff); # it's really complicated
    
  3. or download this
    --
    @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/;
    map{y/X_/\n /;print}map{pop@$_}@/for@/
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-28 23:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found