From owner-freebsd-questions Fri Feb 8 6:22: 2 2002 Delivered-To: freebsd-questions@freebsd.org Received: from fw1.wamnet.com (efw1.wamnet.com [67.98.0.27]) by hub.freebsd.org (Postfix) with ESMTP id C33ED37B425 for ; Fri, 8 Feb 2002 06:21:43 -0800 (PST) Received: from ndm.wamnet.com ([172.17.38.2]) by fw1.wamnet.com (8.12.2/8.12.2) with ESMTP id g18ELgXI002519; Fri, 8 Feb 2002 08:21:43 -0600 (CST) Received: from ds.cops.wamnet.com (ds.cops.wamnet.com [172.17.31.2]) by ndm.wamnet.com (8.9.1a/8.9.1) with ESMTP id IAA13079150; Fri, 8 Feb 2002 08:21:42 -0600 (CST) Received: from y.cops.wamnet.com (y.cops.wamnet.com [172.17.31.43]) by ds.cops.wamnet.com (980427.SGI.8.8.8/970903.SGI.AUTOCF) via SMTP id IAA81063; Fri, 8 Feb 2002 08:21:41 -0600 (CST) Date: Fri, 8 Feb 2002 08:22:14 -0600 (CST) From: Lee J Carmichael X-Sender: lcarmich@y.cops.wamnet.com To: ScaryG Cc: FreeBSD Questions Subject: Re: Perl Question about Splitting up a string In-Reply-To: <20020207214152.1f61d855.freymann@scaryg.shacknet.nu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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