Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Feb 2002 08:22:14 -0600 (CST)
From:      Lee J Carmichael <lcarmich@wamnet.com>
To:        ScaryG <freymann@scaryg.shacknet.nu>
Cc:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Perl Question about Splitting up a string
Message-ID:  <Pine.SGI.3.96.1020208082019.281987N-100000@y.cops.wamnet.com>
In-Reply-To: <20020207214152.1f61d855.freymann@scaryg.shacknet.nu>

next in thread | previous in thread | raw e-mail | index | archive | help
Here is my snippet:


my $line = '[6]joe@domain.com(10.0.0.1)';

my $ip = (split(/[()]/, $line))[1];

print $ip."\n";


--------
Lee Carmichael		WAM!NET Inc.
System Engineer		655 Lone Oak Rd Building E
651-256-5292		Eagan, MN 55121

On Thu, 7 Feb 2002, ScaryG wrote:

> How would one go about cutting up a line like this:
> 
> [6]joe@domain.com(10.0.0.1)
> 
> to get just the IP number at the end in Perl??
> 
> My pattern matching skills lack, as you can tell, but I did manage to
> strip all the other junk out of the line and be left with just this chunk.
> 
> Suggestions?
> 
> gf
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
> 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SGI.3.96.1020208082019.281987N-100000>