http://www.perlmonks.org?node_id=1010715


in reply to -> Is Optional ?

use strict; use warnings;
As the previous poster said, if you haven't got these in your code, you are incredibly talented or incredibly stupid. As the original code is missing a brace in the variable declaration, I think we can guess which ..... :-)
A Monk aims to give answers to those who have none, and to learn from those who know more.

Replies are listed 'Best First'.
Re^2: -> Is Optional ?
by kennethk (Abbot) on Dec 28, 2012 at 16:50 UTC

    Your advice is a little off-point; while the posted code does contain a syntax error, this is a compilation error. Neither the addition of strict nor warnings would give any additional insight into the nature of the issue. Once you fix the curly issue, the code passes both tests just fine. I love these pragma dearly, but will never cite them in a response unless they actually help in the particular situation. Expecting people to include them above every code snippet, or expecting every code snippet to be a full script, is unnecessary orthodoxy.

    You may also wish to peruse ree's profile to gather information about his familiarity with the language.


    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

      Yes, I do apologise; I was aiming for amusement value more than anything else in my comment, but on reading it, it was probably a bit too aggressive.
      A Monk aims to give answers to those who have none, and to learn from those who know more.