On 4/27/07, Jeff Pang <[EMAIL PROTECTED]> wrote:
open FILE,$file or die $!;
while (<FILE>) {
    next unless /\s+(\d+\.\d+\.\d+)\s+/;
    my $version_str = $1;
    my ($lastnum) = $verison_str =~ /.*\.(\d+)/;
    print $lastnum,"\n";
}
close FILE;
snip

umm, why are you testing twice?  Just capture the last digit (instead
of the whole version number) in the first regex.

   next unless /\s+\d+\.\d+\.(\d+)\s+/;
   print "$1\n"

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to