Perl: ternary operator

Perl self-tutoring: the tutor mentions the ternary operator.

Let’s imagine the variable $v0 is not defined, and therefore false from Perl’s point of view.

$v0 ? print ‘defined’ : print ‘not defined’

will output not defined.

a?b:c is known as the ternary operator. If a is true, then b happens; else, c.

Source:

perlmaven.com

roberts perl tutorial

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply