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

Re: Passing logical operators on as content of scalar

by Laurent_R (Canon)
on Feb 08, 2018 at 22:05 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1208759]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-24 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found