Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Better way of matching

by kirbyk (Friar)
on Mar 08, 2006 at 19:14 UTC ( #535232=note: print w/ replies, xml ) Need Help??

in reply to Better way of matching

Another, more general case method, is to use the ? operator:

($net eq $x) ? 1 : 0; is the same as if ($net eq $x) { return 1; } else { return 0; }
The nice thing is that you can cascade them to make readable tableish structures:
($x eq $y) ? _do_something() : ($x eq $z) ? _do_something_else() : ($x eq $w) ? _do_a_third_thing() : _do_default_thing;

-- Kirby,

Comment on Re: Better way of matching
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2016-02-14 07:04 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (459 votes), past polls