Gossamer Forum
Home : General : Perl Programming :

deleting

Quote Reply
deleting
In connection to my previous post I have a problem deleting names from my flat file database

I have a read standard input code

sub read_input {
my( $input, @pairs, $pair, $name, $value );

if ($ENV{'REQUEST_METHOD'} eq "GET") {
$input = $ENV{'QUERY_STRING'};
$get = 1;
}
elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
read (STDIN, $input, $ENV{'CONTENT_LENGTH'});
$post = 1;
}
else {
#* Offline mode goes here.
}

@pairs = split(/&/, $input);

foreach $pair (@pairs) {

($name, $value) = split(/=/, $pair);

$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/[^0-9a-z\/\-_: ]//gi;
$name =~ s/[^0-9a-z ]//gi;

$FORM{$name} = $value;
}
}
and then a delete code

sub EditFile_DeleteUser {
my( $old_list, $new_list, $user_no, $sorted_user );
$old_list .= $comments;
$new_list .= $comments;
foreach $user_no (@keys) {
$sorted_user = "$user_no\::$entrys{$user_no}\n";
$old_list .= $sorted_user;
$new_list .= $sorted_user;
$new_list =~ s/$FORM{DeleteRef}//gi;
$new_list =~ s/^\n//m;
}
open(INFILE, ">>$path$pwd") || die &error_file;
truncate INFILE, 0;
print INFILE $new_list;
close(INFILE);
}

the thing is that the code is working but in my input there is a section where the user has to enter their Japanese input and so i had to take away

$value =~ s/[^0-9a-z\/\-_: ]//gi;
$name =~ s/[^0-9a-z ]//gi;
from the first part of the code but when I did it, the delete code does not work anymore

does anyone know whats wrong?
Subject Author Views Date
Thread deleting wired_lain 2838 Nov 27, 2002, 6:20 PM
Thread Re: [wired_lain] deleting
fuzzy logic 2724 Nov 28, 2002, 12:21 AM
Post Re: [fuzzy thoughts] deleting
wired_lain 2734 Nov 28, 2002, 1:11 AM