Find and delete a line, problems finding
- From: "sakuragirl1" <sakuragirl1@xxxxxxxxx>
- Date: 8 May 2006 11:44:57 -0700
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!
.
- Follow-Ups:
- Re: Find and delete a line, problems finding
- From: Mumia W.
- Re: Find and delete a line, problems finding
- From: Paul Lalli
- Re: Find and delete a line, problems finding
- Prev by Date: Re: MS SQL geek wants to jump ship, plz help on first Perl script
- Next by Date: Reset & m?? (was: Perl regex function call)
- Previous by thread: Segmentation fault using regular expressions
- Next by thread: Re: Find and delete a line, problems finding
- Index(es):
Relevant Pages
|