Article View: comp.lang.perl.misc
Article #236Re: Modifying D-Base fields with PERL.
From: Clay Irving
Date: Tue, 06 May 1997 00:00
Date: Tue, 06 May 1997 00:00
38 lines
2141 bytes
2141 bytes
In <862862948.23367@dejanews.com> Jeremy_Fuller@rocketmail.com writes:
>I was wondering if anybody could help me out on a database question
>pertaining to the PERL programming language. What I want to do is MODIFY
>a Database field when a link is followed or clicked.
>This is an Example:
>name|address|city|state|phone|fax|CODE
>Jeremy Fuller|123 Vr. Lane|Ogden|CA|85560|555-6672|555-7894|RED
>I would like to MODIFY CODE "RED" to CODE "BLUE". How can I accomplish
>this using Perl? Any information you can supply would be appreciated.
open FOO, ">filename" or die "Ack: $!"; # open the file
while (<FOO>) { # for each line in the file
chomp; # remove the newline
# split on |
($name,$address,$city,$state,$phone,$fax,$code) = split /\|/;
if ($code eq "RED") { # if code is "RED"
$code = "BLUE"; # change it to "BLUE"
}
}
close FOO; # close the file descriptor
>If you can, Please e-mail me at Jeremy_Fuller@rocketmail.com (I don't
>check Usenet very often).
Shame on you.
[ mailed and posted ]
--
Clay Irving See the happy moron,
clay@panix.com He doesn't give a damn,
http://www.panix.com/~clay I wish I were a moron,
My God! Perhaps I am!
Technical Details
Message-ID:
<5kmbd9$a90@panix.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<862862948.23367@dejanews.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1043e7,2a246af0f343bb5 X-Google-Attributes: gid1043e7,public X-Google-Thread: 10f591,2a246af0f343bb5 X-Google-Attributes: gid10f591,public X-Google-Thread: fa0ae,2a246af0f343bb5 X-Google-Attributes: gidfa0ae,public From: clay@panix.com (Clay Irving) Subject: Re: Modifying D-Base fields with PERL. Date: 1997/05/06 Message-ID: <5kmbd9$a90@panix.com> X-Deja-AN: 239646478 References: <862862948.23367@dejanews.com> Organization: PANIX Public Access Internet and Unix, NYC Newsgroups: comp.lang.perl.misc,comp.lang.perl.modules,fj.lang.perl