Hi moron,

That's a very entertaining question!  The reason it took me a while to answer is was that I couldn't remember the overriding mistake that I make, out of the many that I make all the time.  I knew there was something, but I just couldn't put my finger on it.

Then I remembered ... the hands-down winner for me is putting semi-colons after values in a declared hash, instead of commas.

That is, I like to write long data structures in this format:

my $p_employee = { 'alice' => { 'salary' => 75000, 'hired' => 1176649545, 'manager' => 'bob', }, 'bob' => { 'salary' => 82000, 'hired' => 1145113545, 'manager' => 'carol', }, 'carol' => { 'salary' => 96000, 'hired' => 1145113545, 'manager' => 'thomas', }, };

But invariably I end up putting semi-colons at the end of one or more lines -- for example:

my $p_employee = { 'alice' => { 'salary' => 75000, 'hired' => 1176649545, 'manager' => 'bob', }; 'bob' => { 'salary' => 82000, 'hired' => 1145113545, 'manager' => 'carol', }; 'carol' => { 'salary' => 96000, 'hired' => 1145113545, 'manager' => 'thomas', }, };

It also seems to happen with a frequency in direct proportion to the complexity of the data structure.  I'm pretty sure this has bitten me more than any other single class of error.


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

In reply to Re: My habitual errors by liverpole
in thread My habitual errors by Moron

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.