Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by fizbin (Chaplain)
on Aug 09, 2005 at 20:55 UTC ( #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
Node Status?
node history
Node Type: note [id://482426]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2020-07-09 17:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?