From owner-freebsd-questions@FreeBSD.ORG Wed Apr 21 10:32:30 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 F20AB16A4CE for ; Wed, 21 Apr 2004 10:32:30 -0700 (PDT) Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9F4D743D2F for ; Wed, 21 Apr 2004 10:32:30 -0700 (PDT) (envelope-from mark@ukug.uk.freebsd.org) Received: from ukug.uk.freebsd.org (parish.gotadsl.co.uk [62.3.235.43]) by smtp.nildram.co.uk (Postfix) with ESMTP id 68D4F252901; Wed, 21 Apr 2004 18:30:17 +0100 (BST) Message-ID: <4086AF7E.5050102@ukug.uk.freebsd.org> Date: Wed, 21 Apr 2004 18:29:34 +0100 From: Mark Ovens User-Agent: Mozilla Thunderbird 7.0 (Windows/20040410) X-Accept-Language: en-gb, en-us MIME-Version: 1.0 To: Barbish3@adelphia.net, freebsd-questions@freebsd.org References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: perl coding ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2004 17:32:31 -0000 JJB wrote: > I have an perl scrip somebody else wrote. > I am just learning perl by modifying this script. > 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); HTH Regards, Mark > Thanks for you help > > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" > > . >