Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Passing logical operators on as content of scalar

by Laurent_R (Canon)
on Feb 08, 2018 at 22:05 UTC ( #1208759=note: print w/replies, xml ) Need Help??


in reply to Passing logical operators on as content of scalar

Really not sure whether this is any better, but you could use (string) eval, as shown here under the debugger:
DB<1> $number1 = 2011; DB<2> $number2 = 2011; DB<3> $selectioncriterium = '==' DB<4> print "number1 is ", eval "$number1 $selectioncriterium $num +ber2" ? "" : "not ", "equal to $number2\n"; number1 is equal to 2011 DB<5> print "number1 is ", eval "$number1 $selectioncriterium 7842 +"? "" : "not ", "equal to 7842\n"; number1 is not equal to 7842

Replies are listed 'Best First'.
Re^2: Passing logical operators on as content of scalar
by gm40 (Initiate) on Feb 09, 2018 at 04:43 UTC
    Thanks for all the help and suggestions. Everything is valuable and has enlightened me.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1208759]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (1)
As of 2018-07-19 03:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (401 votes). Check out past polls.

    Notices?