martinjburgess
IS-IT--Management
Hi I have a little routine that I am struggling with.
Bacically, I need to open a file and read the contents.
The contents are one entry per line in this form: 1339142221
The file name is $username.term
The other variable I have is $messid
What I need to do is read the file and compare the entries against $messid.
If $messid is not matched in the file then append the file with the new $messid.
Here is one of my attempts:
Any help appreciated.
Bacically, I need to open a file and read the contents.
The contents are one entry per line in this form: 1339142221
The file name is $username.term
The other variable I have is $messid
What I need to do is read the file and compare the entries against $messid.
If $messid is not matched in the file then append the file with the new $messid.
Here is one of my attempts:
Code:
fopen(FILE,"+>$members/$username.term");
foreach(@list) {
($msgid) = split(/\|/,$_);
if($_ eq $msgid) { next; }
else {
print "$messid\n"; }
}
Any help appreciated.