I somtimes get weird syntax errors from code that uses callbacks:
get '/foo/bar' => sub { # 30 lines of sub here } # more code here

The reason is that a named sub can end with just a curly bracket (and no semicolon), but the line from the callback needs to be finished with a semicolon. When I forget it, I get synatx errors somewhere below in the following code.

The same happens with eval BLOCK.

But the weirdest errors are not perl errors, but something that can happen in every programming language: accidentally running a different copy of the code than what you just modified. Either because it's in a different directory (or, even harder to find) because you're in an ssh session on one xterm, and on the local computer with another xterm. Since I have near-identical copies of my home directories on multiple machines, that can be a real pain to find out.


In reply to Re: Wierd bugs I would have never expected by moritz
in thread Wierd bugs I would have never expected by ELISHEVA

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.