[Israel.pm] A Nice Subject for Dov

David Baird davidlbaird at gmail.com
Tue Oct 24 15:43:07 PDT 2006


I am a proponent of writing code which is easy to read, and therefore,
maintain. Consider the following regex statement:

$a =~ s{(\w+\.){8}(\w+)\.}{$2};

and if you really wanted to be programmer friendly, add a comment.

-David

On 3/16/06, Levenglick Dov-RM07994 <Dov at freescale.com> wrote:
> perl5.8.7 -e '$a="1.2.3.4.5.6.7.8.9.10";$a=~s/(\w+)\.(\w+)\.(\w+)\.(\w+)\.(\w+)\.(\w+)\.(\w+)\.(\w+)\.(\w+)\./\9/;print $a'
> Produces: 910



More information about the Perl mailing list