From owner-freebsd-questions@FreeBSD.ORG Mon Apr 26 13:49:17 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 6E38816A4CE for ; Mon, 26 Apr 2004 13:49:17 -0700 (PDT) Received: from ex-nihilo-llc.com (ex-nihilo-llc.com [206.114.147.90]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4032143D5A for ; Mon, 26 Apr 2004 13:49:17 -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 BD3EA100; Mon, 26 Apr 2004 16:53:10 -0400 (EDT) Received: from 206.114.147.90 (proxying for 205.204.186.3) (SquirrelMail authenticated user aaron@alpete.com) by mail.alpete.com with HTTP; Mon, 26 Apr 2004 16:53:10 -0400 (EDT) Message-ID: <2487.206.114.147.90.1083012790.squirrel@mail.alpete.com> Date: Mon, 26 Apr 2004 16:53:10 -0400 (EDT) From: "Aaron Peterson" To: drew@mykitchentable.net 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 cc: freebsd-questions@freebsd.org Subject: Perl Help For Newbie 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: Mon, 26 Apr 2004 20:49:17 -0000 for your regex, you might try something like: foreach $line (@input_file) { if ( ($val1,$val2,$val3) = $line =~ /\$(\d\.\d\d)\s+\$(\d\.\d\d)\s+\$(\d\.\d\d)/ ) { $changed = sprintf "%.2f",$val1 * 1.5; s/\$\d\.\d\d\s+\$\d\.\d\d\s+\$\d\.\d\d/\$$changed \$$val3/; } } perhaps the calculation and substitution could all be done in one line, but it makes my head hurt to think about it. Aaron