Gossamer Forum
Home : General : Perl Programming :

deletes a phrase

Quote Reply
deletes a phrase
Hi
I made this script for deleting lines from an ascii file.
I found that it doesn't delete a phrase (composed by 2 or more words)

For example if i try to delete (via form) the word: "White" with no other phrase containing "White" in the database it works correctly
When type something like
-----
White House
White Tie
White
------
I can't delete them.

source:
---------
sub deletecategory {
open(FILE,"$catfile") | | die "could not open catfile";
@cat = (<FILE> );
close(FILE);
$count_lines=0;
foreach $line (@cat) {
$count_lines++;
chomp $line;


if ($line eq $FORM{'category'}) {
$line = '';
}


if ($line ne '') {
$line = "$line\n";
push(@contents, $line);
}
}
open(FILE,">$catfile") | | die "could not open catfile";
print FILE @contents;
close(FILE);
print <<htm;
<HEAD><meta http-equiv="refresh" content="0; url=$ENV{'HTTP_REFERER'}"></HEAD>
htm
}


[This message has been edited by wizard (edited February 19, 2000).]
Subject Author Views Date
Thread deletes a phrase wizard 2529 Feb 19, 2000, 5:17 AM
Post Re: deletes a phrase
wizard 2445 Feb 19, 2000, 7:32 AM
Post Re: deletes a phrase
Stealth 2435 Feb 20, 2000, 1:25 PM