http://www.perlmonks.org?node_id=286715


in reply to Sub-initiate needs help getting started

Any dangers to putting "my" on every variable?

Yes, don't do that. When you write your own code from scratch, you can write it to use all lexical variables, but if you try to retrofit that onto code that wasn't written that way you can get strange results. The "always use strict" advice only applies to new work; you shouldn't try to retrofit it to someone else's code. At least, not until you're confident you know what you're doing.

Warnings you should use. Now, for cgi you don't want warnings on for production use, because they'll mess up the interaction between the script, the web server, and the browser. So you can either test from the command line, or use one of the modules that sends errors and warnings to the browser. Or you can turn on warnings while you're debugging and turn them off again after, which is probably what I'd do. You do know how to tail web server logs, right?

My long-term advice to you is to plan on gradually rewriting the whole thing (or most of it) yourself, in bits and pieces. You'll have an easier time maintaining it that way. But you don't have time to do that all at once right now, so only write the bits you need to write in order to meet your deadline. Later you'll want to add or change more things, and you can (re)write more parts of it at that time.


$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/