dakenah johnson wrote:

> Hi all,
> I am a novice to perl. I find Perl very interesting and I am studying how to
> write and compile perl scripts without syntax and compilation errors. I need
> heads up on how.
>
> thanks,
> DJ

Hi DJ,

You might want to re-think your emphasis here.  Of ocurse, you need to eliminate these 
errors, but not by suppression.  For instance, you can reduce the number of error 
messages vastly simply by removing the use strict; statement.  Your code may then 
compile without explicit error.  Unfortunately there is a good chance that it will not 
be doing what you think it is, or what you want.

These errors, or to be more specific, the rules whose violation invokes the errors, 
are your friends.  They will generally indicate an underlying logic error.  If you 
suppress the error, the program will go ahead and run on broken logic.  That's the 
sort of convenience that could toast a system.

Perl is a syntactically tricky languiage.  Because many of the operators are highly 
context-sensitive, a formulation that works very well in one place will not work at 
all in another.

You definitely should have a basic reference.  Randal Schartz's "Learning Perl" is 
considered the essential starter text, but has one major shortcoming in that it seems 
to constantly make external reference to Larry Wall's Programming Perl.  This strikes 
me as a sort of sweetheart deal.

As the others have told you, use strict and use warnings are a good place to start.  
These will force you to predeclare the scope and containment capacity of your 
variables.  I personally would prefer that data type was also explicitly declared, but 
that's not the way Perl works.  Most Perl users prefer the features that allow us to 
use the same variable to represent both a numerical value and its representation.  As 
for me, it gives me the Willies--but I still use it.

I suggest that you focus first on the logic--what you want to accomplish, what steps 
must be taken to do it, what values must be stored, accessed or manipulated.  The 
language and its syntax are only a medium for communicating that logic, so don't worry 
about syntax errors until you see them.  Then work on specific examples, since there 
is no blanket recipe for preventing them.

One other tip--when you do start testing scripts, and you need jhelp with compiler 
errors, please mark the line numbers the error messages refer to.  You may have to 
change code editors to find one that shows line numbers, but they are the most useful 
debugging information available to you or those helping you.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to