On 9/10/06, John Ackley <[EMAIL PROTECTED]> wrote:

Trying to split class C IPs into network and host parts.

For educational or experimental reasons, I hope, since you're writing
your own low-level code instead of using a module.

this works but I expected the host part in $2:

        print "<$bu>\n" if $debug;
        if( $bu =~ /^((\d+\.){3})(\d+)$/ ) {
                print "$1 $2 $3\n" if $debug;
        }

output:
<172.19.252.130>
172.19.252. 252. 130

where did my thinking jump the tract?
I do see three sets of ()
but the inner () was simply to group for the {3} count

When a memory-parentheses section of a pattern repeats, the memory
holds the match from the "last time through". The last time through
for the second set of parentheses matched "252.". Is that what you
were wondering?

If you don't want the grouping parentheses to trigger memory,
non-memory parentheses are also available.

Cheers!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to