- my $version = $xml->findvalue('/book/bookinfo/revhistory/revision/revnumber');
- die "Unable to get version number\n" unless defined $version && $version =~ /^\d+(\.\d+)*$/;
+ my $version = do {
+ my $version = $xml->findvalue('/book/bookinfo/revhistory/revision/revnumber');
+ die "Unable to get version number\n"
+ unless defined $version and $version =~ /^
+ (?<version>
+ \d+ # major
+ (?:\.\d+(?:\.\d+)?)? # (minor(.patch))
+ )
+ (?:-RC\d+)?$/x; # -RCX
+ $+{version};
+ };