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

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 exploiting the Monastery: (6)
As of 2015-08-30 22:30 GMT
Find Nodes?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...

    Results (351 votes), past polls