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.