http://www.perlmonks.org?node_id=696215

I and others have asked about $VERSION numbers and updating them automatically. After noticing YAWTDI, I decided to investigate the different $VERSION styles found in the wild (where "in the wild" means on a machine of mine).
# get the versions in context locate .pm | grep 'pm$' | xargs | xargs grep -C2 '$VERSION.*=' > versi +ons-C2 # find the interesting versions perl -nle 'if(/\.pm:(.*)/){s/\d/1/g;print}' versions-C2 | sort -u | le +ss # find the popular versions (w/ roughly canonical lines) perl -nle 'if(/\$VERSION.*=/) { s/.*\.pm://; s/\s+/ /g; s/\d+/1/g; pri +nt }' \ versions-C2 | sort | uniq -c | sort -rn | head -n 10 | nl
The top ten (semi-canonical form) from a total of 4707.
1 1892 $VERSION = "1.1"; 2 916 our $VERSION = "1.1"; 3 247 $VERSION = 1.1; 4 243 our $VERSION = 1.1; 5 194 use SVK::Version; our $VERSION = $SVK::VERSION; 6 113 $VERSION = eval $VERSION; 7 87 our $VERSION = do{my@r=(q$Revision:1.1$=~/\d+/g);sprintf"%d.". +"%1d"x$#r,@r}; 8 67 $VERSION = sprintf("%d.%02d", q$Revision:1.1$ =~ /(\d+)\.(\d+) +/); 9 56 $VERSION = "1.02_01"; 10 51 ($VERSION) = sprintf '%i.%03i', split(/\./, \# break for pm.or +g ("$Revision: 2.6$"=~/Revision:(\S+)\s/)[1]); #$Date: 2007/05/07 20 +:33:46 $

The first caveat is that there's a lot of "unique" lines with comments. Another caveat is that there may be build systems filling in $VERSION before deployment. Finally, there are some exotic forms (package vars and glob assignments) not included.

The longest line was in Perl/Tidy.pm (excluding the comments)
( $VERSION = q($Id: Tidy.pm,v 1.64 2007/05/08 20:01:45 perltidy Exp $) + ) =~ s/^.*\s+(\d+)\/(\d+)\/(\d+).*$/$1$2$3/; # all one line for Make +Maker

A few observations. The basic $VERSION = "1.01" is the most popular by far. There's still many keyword expanded $Revision$s parsed into a $VERSION (158). About the same number append $Revision$, $Id$ or $Date$ in a comment.

Despite it's presence in Module/Starter/PBP.pm (twice), qv() versions haven't really taken off (use version; $VERSION = qv('0.0.3')). Similarly, bare \d.\d.\d versions are rare, as are fully-qualified package versions, glob assignments and "alpha" suffixes.

Performing the ExtUtils::MakeMaker eval reveals that the most common version is 0.01. The most common format is \d.\d\d (3025), next is \d.\d\d\d (433), then v\d.\d.\d (216).

I quite like the SVK solution for app-wide versions:

# SVK::* modules: use SVK::Version; our $VERSION = $SVK::VERSION; # In SVK::Version itself: use version; our $VERSION = qv(2.0.2);

Although the possibility of arbitrary code running on a version evaluation is a little troubling.

Some other interesting versions are:
# 2005.082401 $VERSION = 2005.0824_01; # 5.402212 $VERSION = sprintf "%.6f", substr(q$Rev: 2212 $,4)/1000000 + 5.4; $VERSION = (qw$LastChangedRevision: 388 $)[1]; # 12.009530 $VERSION = sprintf("12.%06d", q$Id: DBD.pm 9530 2007-05-09 13:05:23Z t +imbo $ =~ /(\d+)/o); $VERSION = 1.19_01; # ^ ^^ ^^-- Incremented at will # | \+----- Incremented for non-trivial changes to features # \-------- Incremented for fundamental changes
Some modules wrap the $VERSION assignment in either a BEGIN or (as we do) a use param:
use Our::Config ( application => 'app-name', version => (our $VERSION = '3.1'), config => \$config, );
Any I've missed in my sample?