Re: [PBML] finished...
- Franki <frankieh@...> wrote:
: but didn't know how to do the return..
: I figured it would have to be something like this:
: ($href_cat_list, $option_cat_list) = Category_list;
: So I figured I'd get it to work, then worry about the semantics...
I'm not sure that's a good idea. "Getting it to work" may not
speed you up much. Going back over working code will slow
you down (if you get to it at all). There is no wrong way in perl,
but there are some better practices and idioms. Doing the
Good Things now will speed development later.
: I didn't know it was necessary to pass all variables to a sub,
: but I guess that makes sense...
It's not necessary. It's good programming. The difference is in
the maintenance and the readability. Most good programmers
develop certain habits that are accepted by other good
programmers. When examining a new program they tend to
remember these habits and, spotting them, can quickly
determine it's purpose.
The ideal is a subroutine should be able to be given as an
assignment. "These are your inputs, and these are the outputs.
Go to it, son!" By not relying on external values, we can control
the inner working of the assignment better.
: I want to turn this and several others from this list into a sort
: of newbie guides, not to teach them perl, but to fix their code
: once they have learned abit.. you guys are doing it for me, so
: why not see if I can turn it into something useful..
I thought of something similar with a code review process.
I ran into a stumbling block. It seems many scripts and
subroutines are better completely re-written. The problems
reside in the approach AND the coding, not just the coding.
Charles K. Clarkson
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Small commercial and residential rehabilitation specialists.
CJ Web Work - Solutions for Real Estate Investors.