msknr
asked on
string searching
here is what I want to do...
I have a flat file db with the following...
"Ryan","ryan@ryan.com"
"Bill","bill@bill.com"
etc....
I want to remove an entry by email address... what can I use to test if ryan@ryan.com is in a line, if so remove it.
open(file,"/path/data.dat" );
@data = <file>;
close(file);
open(newfile,">path/data.d at");
foreach $line (@data) {
chop($line);
if (!($line contains ryan@ryan.com)) {
print newfile "$line\n";
}
close(newfile);
thanks!
I have a flat file db with the following...
"Ryan","ryan@ryan.com"
"Bill","bill@bill.com"
etc....
I want to remove an entry by email address... what can I use to test if ryan@ryan.com is in a line, if so remove it.
open(file,"/path/data.dat"
@data = <file>;
close(file);
open(newfile,">path/data.d
foreach $line (@data) {
chop($line);
if (!($line contains ryan@ryan.com)) {
print newfile "$line\n";
}
close(newfile);
thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
print newfile "$line\n";
}