There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Well here is two thoughts:
1) Use the dbi library for csv. This way you could just have a flat file database of users with their karama values that could be easily queried and inserted into. Letting the dbi library handle the quering and the data updates without constant file overwrites. This should also reduce the memory footprint of the file as it grows in size. Just use dbi and then connect to the karma.txt as a flat file database. You will have to insert some tabs or commas if you don't currently have them inserted. 2) Instead of reading and writing the file over and over .. note this is if it is a small file, just read into a memory hash or array, your choice but with the small amount of info to be stored i would say array, and then let the array just overwrite the file at the end of the execution. In this way you would only read and write to the disk once and handle all the rest of the transactions in memory which is much faster and would allow replacements within the array. Hope thats helps. Dave In reply to Re: Storing karma
by Zapawork
|
|