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 (Chancellor) 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 (Chancellor) 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". ;-)