Steveo wrote:

> Thanks to the people on this list I've been able to create a form
> submission page that writes team data for a fps league to a data file.  I
> can also call up that data and present it 'nicely' on a web browser.  The
> next step for me is to be able to submit the name of a clan I want to drop
> from the data file and have a script delete it.  My data file is a simple
> ascii text file that looks like this:
> 
> clan1,leader1,webpage1
> clan2,leader2,webpage2
> clan3,leader3,webpage3
> etc...
> 

try:
1. open the file for reading
2. write whatever you need to a tmp file
3. rename the tmp file to your original file

this's basically what Perl inline editing is doing. for example:

#!/usr/bin/perl -w
use strict;
use File::Temp qw/tempfile tempdir/;

my $org_file = 'org.txt';
my $tmp_file = (tempfile(DIR => tempdir(CLEANUP => 1)))[1];

open(ORG,$org_file)    || die $!;
open(TMP,">$tmp_file") || die $!;
while(<ORG>){
        print TMP unless(/^clan2/);
}
close(ORG);
close(TMP);

rename($tmp_file,$org_file) || die $!;

__END__

the code will work as long as your files are small, once they get bigger and 
bigger, this kind of thing is not going to work well. you will want a DBMS 
such as mySQL,Oracle...etc

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to