Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Passing logical operators on as content of scalar

by Lotus1 (Curate)
on Feb 08, 2018 at 17:30 UTC ( #1208729=note: print w/replies, xml ) Need Help??


in reply to Passing logical operators on as content of scalar

You can get it to be shorter with the ternary operator. This replaces your elsif block.

elsif ($selectioncriterium eq '=='){ print "$number1 is ", $number1 == $number2 ? '' : 'not ', "equal t +o $number2\n"; }

For <, >, == it isn't as easy since there are three choices.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2018-06-23 20:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (125 votes). Check out past polls.

    Notices?