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

Re: Rules based Perl

by BrowserUk (Patriarch)
on Nov 05, 2003 at 19:36 UTC ( [id://304838]=note: print w/replies, xml ) Need Help??


in reply to Rules based Perl

Comparing single values against a list of values isn't too hard.

use List::Util qw[ min max ]; if( $X < min( $a, $b, $c ) and $Y > max( $a, $b, $c ) or $Z < min( $b, $c, $d ) ) { # do something }

The lists can equally be arrays of as many values as you need.

Unfortunately, the example is incomplete. I couldn't find a state diagram for 'possibly' :)


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
Hooray!
Wanted!

Replies are listed 'Best First'.
Re: Re: Rules based Perl
by thor (Priest) on Nov 06, 2003 at 13:23 UTC
    Couldn't 'possibly' be interpreted as 'or'? For instance, if I have 'b and c but possibly a', couldn't I also write that as 'a or (b and c)'? That way, the evaluation of a does not necessarily determine the truth of the entire staement, but it has the possibility of making the entire statement evalutate to true.

    thor

      Possibly:)


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      Hooray!
      Wanted!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-05-27 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found