in reply to substr on $_

After seeing the suggested regexes, I'm going to offer a slight change:
s/\d+(\d\d)\./$1/; # no need for the (\d+) at the end # being replaced by $2 (itself!)

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
Re: Re: substr on $_
by Anonymous Monk on Sep 28, 2001 at 02:20 UTC

    Alternatively, no need to capture anything. Although alternation is generally an efficiency pig, for these small strings it tests a bit quicker.

    s/^\d\d|\.//g;