Conditional Blocks

For more complex operations if and unless can be used to control the execution of whole blocks.

if ($a == $b) {
  print "a equals b\n";
  $a += $b;
}

unless ($a == $b) {
  print "a does not equal b\n";
  die "Operation aborted!";
}


<< Previous
Contents >> Next >>

Lincoln D. Stein, lstein@cshl.org
Cold Spring Harbor Laboratory
Last modified: Wed Oct 11 20:47:43 EDT 2000