Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Perl IP's etc


Scott Howard wrote:
> 
> On Sun, Sep 16, 2001 at 11:39:33PM +1000, peterw wrote:
> > Given an alpha numeric string of vaying length that contains 0 or more
> > valid IP numbers(dotted quad decimal)and each IP(if there is one) is
> > seperated form the next IP or other text by one or more spaces how can I
> > use Perl to retrieve thes IP's  into an array ?
> 
> Presuming the string is in $_
> @IP = split;
> 
>   Scott.

Sorry should have explained better. String can have one or more groups
of alpha numeric characters. Each group of chracters is seperated by one
or more spaces. Each group can have one or more charcters. Zero or more
of these groups may be a valid IP. The IP 's can occur anywhere in the
string. The IP's may or may not be consecutive.

If I use split how do I know which array elements are the IP's ?

Peter