Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Write to file, after manipulationby ibanix (Hermit) |
on Jan 28, 2003 at 04:02 UTC ( [id://230480]=note: print w/replies, xml ) | Need Help?? |
Hi, First off, have you looked at Net::IRC, Bot::BasicBot or Bot::Pluggable? They may save you some time, unless you're determined to reinvent the wheel. If you are, see if you can build a whole bike for us. :-) I'm not sure how your code looks outside of your posting, but may I suggest you use a set of functions that is given to easily readable and reuseable code? I happen to like the following type of method myself: I'm not saying this is the best way to do it, but it's worked for me when I need to multiplex between a number of different choices. It keeps my code bits isolated from each other, and it's easy for other people to read. This being said, I'm still trying to figure out how a dispatch table works -- if you can figure that one out, that might be a good bet for you. I should probally attempt to answer your question, eh? :-) You're opening the file as open(REMOVE, ">project.pjt") Which is output only, but you're trying to read from it via If you have use warnings turned on, when you try this you should get an error like: To open a file for reading AND write, use: but this will clober your file, removing any contents before you can read from it. Use if you want to read and write (append) to the file without zapping the contents everytime. See also the perl Open() tutorial. Hope this helps (and that I got it right), ibanix $ echo '$0 & $0 &' > foo; chmod a+x foo; foo;
In Section
Seekers of Perl Wisdom
|
|