[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Elegant ways to pick up the RCS revision



Bernie Cosell <bernie@fantasyfarm.com> wrote:
> On 7 Apr 2001, at 11:40, Abhijit Menon-Sen wrote:
> > On 2001-04-06 23:57:55, bernie@fantasyfarm.com wrote:
> > > 
> > > my $version = (split(/ /, '$Revision: $'))[1] ;
> > 
> > ($VERSION) = q$Revision: 1.01 $ =~ /(\d+\.\d+)/;
> 
> Doesn't quite work [e.g., the revision I'm looking at right now is 
> 1.14.2].   But that's easy to fix:
> 
> ($VERSION) = q$Revision: 1.01 $ =~ /(\d+(?:\.\d+)+)/;

Or just 

  ($VERSION) = q$Revision: 1.01 $ =~ /([\d.]+)/;

or even

  ($VERSION) = q$Revision: 1.01 $ =~ / (\S+)/;

which approximates your original in effect, and allows for 
letters in version numbers.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe