Moin Rolf,
sub is_leapyear{
my $year = shift;
my $v = 0;
if(!$year) { return "-1" }
if($year%4==0) { $v = 1 }
if($year%100==0) { $v = 0 }
if($year%400==0) { $v = 1 }
return $v;
}
eleganter (perliger) waere imho:
sub is_leapyear ($) {
my $year = shift;
not $year % 4
and ( $year % 100 or not $year % 400 );
}
(gibt obendrein wirkliche boolean-werte (im Perl-Sinne) zurueck, '0' ist nicht immer == 'false').
Viele Gruesse,
n.d.p.