Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Passing logical operators on as content of scalar

by tybalt89 (Curate)
on Feb 08, 2018 at 20:19 UTC ( #1208747=note: print w/replies, xml ) Need Help??


in reply to Re^2: Passing logical operators on as content of scalar
in thread Passing logical operators on as content of scalar

print $number1, " is ", ("equal to", "greater than", "less than")[$number1 <=> $number2], " ", $number2, "\n";

No need to add one :)

Replies are listed 'Best First'.
Re^4: Passing logical operators on as content of scalar
by soonix (Monsignor) on Feb 08, 2018 at 21:14 UTC
    I had thought about that, but decided that it would be easier to grasp without negative indices :-)
Re^4: Passing logical operators on as content of scalar
by afoken (Abbot) on Feb 10, 2018 at 18:52 UTC

    Nice trick, but it calls for an explaining comment.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2018-02-23 13:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (302 votes). Check out past polls.

    Notices?