in reply to using split to assign a single variable

In the spirit of TIMTOWTDI:

I use this:  my $version = '$Revision: 1.47 $'; and then I only have to parse out $Revision: and the trailing $'. And that can be done diffrent regex schemes, one method might be: $version =~ s/[^\d.]+//g; (Strip all but digits and .'s).

Replies are listed 'Best First'.
Re: Re: using split to assign a single variable
by c (Hermit) on Jul 21, 2001 at 05:32 UTC
    And here is one more way to do it! Its based on your use of $Revision:$
    Check it out:

    my($rcs) = (q$Revision: 1.37 $ =~ /(\d+(?:\.\d+)+)/);

    humbly -c

Re: Re: using split to assign a single variable
by c (Hermit) on Jul 21, 2001 at 01:52 UTC
    I missed the forest for the trees on that one. The regex substitution is much easier and I frankly can't believe that I didnt think of it earlier. Talk about being so fixated on an issue that I missed the easy way out.

    VERY humbly -c