3 use warnings FATAL => 'all';
6 my @ymd = (gmtime)[5,4,3];
9 my $changes_line = sprintf "%s - %i-%02i-%02i\n", $version, @ymd;
11 foreach my $changes (@ARGV) {
12 print "Adding $version heading to $changes.\n";
13 open my $fh, '+<', $changes
14 or die "Can't open $changes: $!";
22 elsif (/^v?(\d+(?:\.\d+)*)(\s+|$)/) {
24 die "$changes already has an entry for $version!\n";
27 die "No changelog entries found before $1!\n";
30 elsif (/^\s+[-*+#]/) {
31 $content .= $changes_line;
39 print { $fh } $content;