Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
(bbfu) Re: Storing karmaby bbfu (Curate) |
on Jun 28, 2001 at 07:30 UTC ( [id://92169]=note: print w/replies, xml ) | Need Help?? |
First off, you're greping for $user on a list with the single element of ("karma.txt"). That will always return a $results of 0 (I think, or maybe undef) unless the user's name happens to be "karma" (or "karma.txt", or "kar", etc). I'm guessing that's not what you mean. I think you're trying to avoid reading in the whole file if the user does not exist. Unfortunately, you can't <update>because you end up reading in the whole file before searching it anyway</update>. So you might as well go ahead and avoid the extra logic... (Note! This is untested!!)
Update: I like RhetTbull and Zapawork's suggestions better. :-p bbfu
In Section
Seekers of Perl Wisdom
|
|