From owner-freebsd-questions@FreeBSD.ORG Mon Apr 26 11:20:25 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 0662816A4CE for ; Mon, 26 Apr 2004 11:20:25 -0700 (PDT) Received: from relay02.roc.ny.frontiernet.net (relay02.roc.ny.frontiernet.net [66.133.131.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id 705B643D58 for ; Mon, 26 Apr 2004 11:20:24 -0700 (PDT) (envelope-from drew@mykitchentable.net) Received: (qmail 8037 invoked from network); 26 Apr 2004 18:20:23 -0000 Received: from 67-51-156-100.dsl1.elk.ca.frontiernet.net (HELO blacklamb.mykitchentable.net) ([67.51.156.100]) (envelope-sender )SMTP for ; 26 Apr 2004 18:20:23 -0000 Received: from mykitchentable.net (unknown [165.107.42.233]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by blacklamb.mykitchentable.net (Postfix) with ESMTP id 3BC013BF398; Mon, 26 Apr 2004 11:20:22 -0700 (PDT) Message-ID: <408D52E9.5090700@mykitchentable.net> Date: Mon, 26 Apr 2004 11:20:25 -0700 From: Drew Tomlinson User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: aaron@alpete.com References: <408D3DD7.1050607@mykitchentable.net> <58959.204.118.78.206.1082999243.squirrel@mail.alpete.com> <408D435A.70506@mykitchentable.net> <4914.206.114.147.90.1083002506.squirrel@mail.alpete.com> In-Reply-To: <4914.206.114.147.90.1083002506.squirrel@mail.alpete.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-questions@freebsd.org Subject: Re: Perl Help For Newbie 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: Mon, 26 Apr 2004 18:20:25 -0000 On 4/26/2004 11:01 AM Aaron Peterson wrote: >>On 4/26/2004 10:07 AM Aaron Peterson wrote: >> >> >> >>>>Any guidance as to the best way to approach this task would be most >>>>appreciated. I've >>>>done lots of reading but haven't found anything that teaches me how to >>>>"think" about >>>>building this script. >>>> >>>> >>>> >>>> >>>probably the best way to approach this is writing a script to generate >>>the >>>complete html in multiple formats instead of writing a script to search >>>through html to find values, calculate, and replace. what i mean, is if >>>you had a single file with the US dollar values for everything, then you >>>wrote a script that used those values to generate complete html pages >>>(doing whatever conversions you needed in the process), that would >>>probably be easier than searching through pre-existing html and doing >>>substitution via regex. then in the future you would only have to change >>>prices in one place and re-run the script, or change the conversion >>>algorithm and rerun the script to get all new html pages. (html, xml and >>>other markup is notoriosly difficult to regex) >>> >>> >>> >>> >>This makes sense but how would I keep the files "in sync". I mean how >>would I be sure that $xx.xx amount corresponded to y product? Would it >>just "work" because each entry in the description array would have a >>corresponding entry in the price array? My fear is getting off by one >>and then having every entry after that be incorrect. Is this a big risk? >> >>Thanks for your reply. I know I have a lot to learn. >> >> > >I'm saying with a text data file like the following (data.txt): > >Item Number One:3.50 >Item Number Two:2.25 >Item Number Three:300 >Item Number Four:25.75 > > I understand. However, because my source file is already an HTML doc, I would have to some how extract the relevant parts into the data file you describe. Would this still be the preferred way to do it? >Hope that helps give you ideas. > > Yes. I appreciate your time. Thanks, Drew