Thanks to both James and Paul - that solution worked great.

Thanks!

Jason

-----Original Message-----
From: James Edward Gray II [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 31, 2004 3:17 PM
To: Perl Beginners
Cc: Price, Jason (TLR Corp)
Subject: Re: Matching ranges of IP addresses



On Mar 31, 2004, at 3:09 PM, James Edward Gray II wrote:

> On Mar 31, 2004, at 3:02 PM, James Edward Gray II wrote:
>
>> On Mar 31, 2004, at 2:50 PM, Price, Jason (TLR Corp) wrote:
>>
>>> I am working on a script that searches through a log file, looking 
>>> for IP matches based on several ranges of IPs.  I'm trying to find a 
>>> way to do something like this:
>>>
>>> @results = grep /192.168.0.[192-254]/, @list
>>
>> @results = grep m/192.168.0.\d{3}/ and $1 >= 192 and $1 <= 254, @list;
>
> Sorry to reply to my own message, but I believe I made a mistake up 
> there.  I think you have to switch those ands to &&s.  Sorry about 
> that.

Egad, I forget the parens around the \d{3} too.  Use Paul's solution.  
It's what I meant, minus about five mistakes.  I must be dumb today.

James


--
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