Looping backreferences

Andrew Savige ajsavige at yahoo.com.au
Wed Aug 20 23:36:29 CDT 2003

Joshua Goodall wrote:
> I would like (for no other reason than shorter lines and out of
> curiousity) to be able to more intuitively write
> $net = join ".", reverse $zone =~ /^(?:(\d+)\.){2,3}in-addr\.arpa$/;
> but of course this only returns a single backreference, not the three
> I'm hoping for when I feed it "3.2.1.in-addr.arpa".

We could try eliminating the join and the reverse:

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


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

More information about the Melbourne-pm mailing list