On Tue, Nov 29, 2011 at 06:19:59PM -0500, Nemana, Satya wrote:
> Hi Brandon, Igor, Shawn

Hello (not sure if it's proper to call you Nemana or Satya or if
both names are necessary):

> The horror was that the perl compiler pointed at a code some
> 1000s of lines below this line for the error which was
> completely confusing.

It's pretty normal for compiler/interpreter errors to give
misleading results. Some tools are better than others, but the
more complicated the language the more complicated the error. The
parser doesn't know what you intended. Those 1000s of lines were
probably actually valid Perl and it wasn't until perl found some
invalid character (or didn't find some required character) that
it complained. In C++, a couple of tiny little errors can result
in 1000s of very ugly errors under the right circumstances. ;D

> Now I learnt how small mistakes can take hours to resolve and
> will be careful in future.

Now part of the problem might well be that you have 1000s of
lines. :) Ideally, you should break your program up into pieces.
You can use subroutines to split functionality into multiple
pieces and store them each in a different file. A good way to do
this is with Perl modules (see perlmod, perlmodlib, and others).
This way when you make a mistake like this there is less code
that could be a problem (because it's split into smaller files).

You can try not to make these mistakes, but we are all human so
inevitably we will eventually make them anyway. :) You should
focus more on organizing the code so it's easier to spot the
error.

Regards,


-- 
Brandon McCaig <[email protected]> <[email protected]>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bamccaig.com/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'

Attachment: signature.asc
Description: Digital signature

Reply via email to