Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: a learning exercise - diary program

by ColonelPanic (Friar)
on Jan 27, 2001 at 01:42 UTC ( #54649=note: print w/ replies, xml ) Need Help??


in reply to a learning exercise - diary program

Nice, looks like solid coding altogether. Here are a few thoughts:

It doesn't really matter in a simple program like this, but in general you shouldn't open files sooner than you need them, it wastes memory. You could open the file after the diary entry is entered. Or, you could open the file beforehand and use an implementation like this:

#files are open already print "Write to diary. Type quit when finished."; while (($_=<STDIN>) != "quit\n") { print FILE $_; print DIARY $_; }
Now you aren't reading the entire diary entry into memory, only one line at once. Like I said earlier, it is trivial in this program. But it will pay later to think about things like this. Overall, though, it looks good. I've seen plenty of code created for commercial use that is a lot worse than this.

When's the last time you used duct tape on a duct? --Larry Wall


Comment on Re: a learning exercise - diary program
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://54649]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2014-07-10 03:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (198 votes), past polls