If I understood your question correctly, then this piece of untested code should set you up (actually, you were close except for the print thing...) I assumed you only needed the file created when the sorry word appeared. If this is not the case, take the existence test out as you put it originally. I believe my version of the regexp is easier to pick up.
if ($msg =~ /^so?r?ry/) { if (! -e "emotions/$victim.emo") { open (DATA, ">emotions/$victim.emo"); print DATA "1\n"; close (DATA); } else { open (FILE, "+>emotions/$victim.emo"); chomp($emo = <FILE>); seek(FILE, 0, 0); print FILE ++$emo, "\n"; close(FILE); return "it's OK."; } }
Also, note that you need to open the file for reading and writing instead of just writing. Otherwise you would clobber the prior contents.
Finally, remember to use strict and use warnings.
Best regards
-lem, but some call me fokat
In reply to Re: Need Help w/ AIMBot
by fokat
in thread Need Help w/ AIMBot
by Sleepaholic88
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |