Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Stupid mistakes I repeatedly make

by jhourcle (Prior)
on Mar 28, 2005 at 02:31 UTC ( #442733=note: print w/replies, xml ) Need Help??

in reply to Stupid mistakes I repeatedly make

I make way too many typos when writing code, and I'll say that I tend to classify them in the following manner, in no particular order:
  • Those items completely slip through both use strict; and use warnings;. Take for instance the following:

    #@array contains an odd number of values. my %hash = ( key => @array ); # when you meant to say: my %hash = ( key => \@array ); # or my %hash = ( key => [@array] );

    This item includes just about any logic error, too.

  • Those items that generate useful error messages, provided you had both use strict; and use warnings; in place. (too many to list). As things go, I like these, much better than the others.

  • Those items that generate error messages, even without use strict; or use warnings. Of course, this group should never matter, as there's really no excuse for not using strict and warnings. (when you need to shut a warning off, fine, but just shut off the particular warning you need, in the limited scope that it's needed).

  • The items that throw errors, but they're either useless errors that you can't easily trace, or they point you to some line number that's functionally useless:

    Missing right curly or square bracket at line 3281.

    Okay, it's not useless, but it's something when the error message tells you something's wrong, but you have to do some real digging 'till you actually find where the problem is, and just what you've managed to do wrong. (this includes any of those error messages where it takes more than 5 minutes to track down just what went wrong).

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2021-10-23 15:36 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (88 votes). Check out past polls.