Perl: if then else
Example of “if” statement:
use utf8; # example of if $x = 1; if ($x == 1) { print "yes\n"; }
Example of “if else”:
use utf8; # example of if else $y = 2; if ($y == 1) { print "yes\n"; } else { print "no\n"; }
Example of “if else” chain:
use utf8; # example of if else chain $z = 2; if ($z < 0) { print 'neg'; } elsif ($z == 0) { print 'zero'; } elsif ($z == 1) { print 'one'; } else { print 'other'; }