In Pearl, we use ternary operators so we don't have to use the if-else statement. The operator makes the codes look nice and clean, which makes them easy to understand.
One of the most apparent important use of a ternary operator is that it replaces the use of the if-else state in a more clean, readable, and short form.
cond ? val if true : val if false
cond: This is the code/expression whose output defines the value that is used.? is returned if the condition returns true.: is returned if the condition returns false.print(1==0 ? 'right' : 'wrong',"\n");
1 is equal to 0. This is definitely false, and that's why the wrong message displays.