S
sakuragirl1
I got my first PERL project last Monday and have written 3 pages of
working PERL, but 1 page is driving me nuts! I am very much a newbie,
so please have patience with me. below is a snippet of my code that is
having problems.
open(LISTFILE, "<.ccglist");
open(TEMPFILE, ">.tempfile");
while ($line=<LISTFILE>) {
print TEMPFILE $line unless $line =~ (/$accountnumber/ &&
/$effectivedate/);
}
close TEMPFILE; close LISTFILE;
unlink ".ccglist";
rename ".tempfile", ".ccglist";
I have finally got the deleting of a line working, but it is the
finding i am having a problem with. two problems really:
1) I need to search for a line that has the indicated account number
and effectivedate. I have found that this code will not take into
account the effective date.
2)I have tried without the effective date and it will find the
account number, but also finds any accounts that start with the account
number begining "pattern" as well. i need it find JUST the accounts
that match EXACTLY. e.g. user wants to delete account 123456, code
deletes 123456 AND 1234567.
Thank you so much for any suggestions. I love working in PERL and hope
to have more time to study it, but I need to turn this project in ASAP.
Thanks again!
working PERL, but 1 page is driving me nuts! I am very much a newbie,
so please have patience with me. below is a snippet of my code that is
having problems.
open(LISTFILE, "<.ccglist");
open(TEMPFILE, ">.tempfile");
while ($line=<LISTFILE>) {
print TEMPFILE $line unless $line =~ (/$accountnumber/ &&
/$effectivedate/);
}
close TEMPFILE; close LISTFILE;
unlink ".ccglist";
rename ".tempfile", ".ccglist";
I have finally got the deleting of a line working, but it is the
finding i am having a problem with. two problems really:
1) I need to search for a line that has the indicated account number
and effectivedate. I have found that this code will not take into
account the effective date.
2)I have tried without the effective date and it will find the
account number, but also finds any accounts that start with the account
number begining "pattern" as well. i need it find JUST the accounts
that match EXACTLY. e.g. user wants to delete account 123456, code
deletes 123456 AND 1234567.
Thank you so much for any suggestions. I love working in PERL and hope
to have more time to study it, but I need to turn this project in ASAP.
Thanks again!