From owner-freebsd-questions@FreeBSD.ORG Wed Apr 21 10:42:48 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B8EF16A4CE for ; Wed, 21 Apr 2004 10:42:48 -0700 (PDT) Received: from ex-nihilo-llc.com (ex-nihilo-llc.com [206.114.147.90]) by mx1.FreeBSD.org (Postfix) with ESMTP id 64FB243D60 for ; Wed, 21 Apr 2004 10:42:48 -0700 (PDT) (envelope-from aaron@alpete.com) Received: from mail.alpete.com (localhost [127.0.0.1]) by ex-nihilo-llc.com (Postfix) with SMTP id 5A9BF68 for ; Wed, 21 Apr 2004 13:46:36 -0400 (EDT) Received: from 162.114.211.139 (proxying for 172.26.10.245) (SquirrelMail authenticated user aaron@alpete.com) by mail.alpete.com with HTTP; Wed, 21 Apr 2004 13:46:36 -0400 (EDT) Message-ID: <47729.162.114.211.139.1082569596.squirrel@mail.alpete.com> In-Reply-To: <4086AF7E.5050102@ukug.uk.freebsd.org> References: <4086AF7E.5050102@ukug.uk.freebsd.org> Date: Wed, 21 Apr 2004 13:46:36 -0400 (EDT) From: "Aaron Peterson" To: freebsd-questions@freebsd.org User-Agent: SquirrelMail/1.4.2 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal Subject: Re: perl coding ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: aaron@alpete.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2004 17:42:48 -0000 >> An temp field $dup-counter contains an counter that is >> suffixed with x as in 23x have no idea how big of an >> number the counter can grow to. The suffix is all ways >> one position but has different alpha values. >> >> How do I separate $dup-counter into two new fields? >> $dup-number and $dup-sufix > This will do it: > > $dup-number = substr($dup-counter, 0, length($dup-counter) - 1); > $dup-suffix = substr($dup-counter, -1, 1); or alternately: ($dup-number,$dup-suffix) = $dup-counter =~ /(\d+)(\w+)/; the regex could be loosened or made more strict as needed... aaron