Looping backreferences

Andrew Savige ajsavige at yahoo.com.au
Thu Aug 21 07:14:53 CDT 2003


Joshua Goodall wrote:
>> 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. :-)
> 
> "... and then I shot him, your Honour."
> 
> :) nicely done!

Why, thankyou. Variety being the spice of life:

$zone=~s/^(\d+)\.(\d+\.)((?:\d+\.)?)in-addr\.arpa$/$3.$2.$1/e;#blastoff!

Sorry, I just had to do it. :-)

/-\


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



More information about the Melbourne-pm mailing list