On Wed, Mar 31, 2004 at 02:50:30PM -0600, 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
> 
> Which, obviously, doesn't work.  Is there any way to specify a range
> of multi-digit numbers in a regular expression?

Does it really need to be a regular expression?

@results = grep /192.168.0.(\d+)/ && $1 >= 192 && $1 <= 254, @list;

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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