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).]
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).]