# rip out old serial
my ($old_serial) = $fh_contents =~ /IN\s+SOA\s+\S+\s+\S+\s*(?:\s*\;.+\n)*\((?:\s*\;.+\n)*\s*(\d+)/;
my ($ymd,$iter) = $old_serial =~ /(\d{4}\d{2}\d{2})(\d{2})/;
- my $new_serial = strftime("%Y%m%d",gmtime)."01"
- if ($ymd == strftime("%Y%m%d",gmtime)) {
+ my $new_serial = strftime("%Y%m%d",gmtime())."01";
+ if ($ymd eq strftime("%Y%m%d",gmtime())) {
$new_serial = $ymd.($iter+1);
}
$fh_contents =~ s/(IN\s+SOA\s+\S+\s+\S+\s*(?:\s*\;.+\n)*\((?:\s*\;.+\n)*\s*)(\d+)/${1}${new_serial}/;