Looping backreferences

Andrew Savige ajsavige at yahoo.com.au
Thu Aug 21 04:06:42 CDT 2003


> We could try eliminating the join and the reverse:
>
> $net = "$+." x defined($3)."$2.$1"
>    if $zone =~ /^(\d+)\.(\d+)\.(?:(\d+)\.)?in-addr\.arpa$/;

which can obviously be improved by fiddling with the parentheses:

$net="$3$2.$1" if $zone=~/^(\d+)\.(\d+)\.((?:\d+\.)?)in-addr\.arpa$/;

which is finally a one-liner. :-)

/-\
--
You want it in one line?  Does it have to fit in 80 columns?   :-)
             -- Larry Wall in <7349 at jpl-devvax.JPL.NASA.GOV>


http://search.yahoo.com.au - Yahoo! Search
- Looking for more? Try the new Yahoo! Search



More information about the Melbourne-pm mailing list