Perl has an unless statement (and an unless modifier), which work exactly like the corresponding ifs, but negate their condition.

So you can say

die "Usage: $0 [-x] file1 file2\n"
  unless @ARGV >=2 and @ARGV <= 3;
You can also say
sub factorial {
  my $n = shift;
  unless ($n <= 1) {
    $n*factorial($n-1);
  }
  else {
    1;
  }
}
but you probably shouldn't.

Un*less" (?), conj. [Formerly, onles, onlesse, onlesse that, that is, in less, in a less case. See On, and Less.]

Upon any less condition than (the fact or thing stated in the sentence or clause which follows); if not; supposing that not; if it be not; were it not that; except; as, we shall fail unless we are industrious.

⇒ By the omission of the verb in the dependent clause, unless was frequently used prepositionally, -- a construction common in Shakespeare and still employed colloquially.

Here nothing breeds unless the nightly owl. Shak.

 

© Webster 1913.

Log in or register to write something here or to contact authors.