Jasmine wrote:
> 
> hi

Hello,

> i m faced with a problem.
> 
> i have a string set to an IP address and i want to be able to compare it with
> just the first three octets and see if it matches. How do i go about?
> I know regex can do it but the problem is i m a newbie to it. If anyone can
> figure out and explain the regex for it, it will be extremely beneficial.

Here is one way to do it:

use Socket;

print "Matched\n" if substr( inet_aton( $ip1 ), 0, 3 ) eq substr( inet_aton( $ip2 ), 
0, 3 );



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to