foo instead of $foo, buried deeply in a mountain of shit source code. A bareword, meant to be a variable-reference, but acceptable to the Perl compiler.

How would "the Perl compiler" accept 'foo' as a bareword if you were using strict and/or warnings? Couldn't you find the problem immediately if you turned those on?

#! perl # 1134136.pl use strict; my ($bottom, $top); my @mountain = ($bottom, $top, foo); exit;
[05:38][nick:~/monks]$ perl 1134136.pl Bareword "foo" not allowed while "strict subs" in use at 1134136.pl li +ne 4. Execution of 1134136.pl aborted due to compilation errors.
#! perl # 1134136-2.pl use warnings; my ($bottom, $top); my @mountain = ($bottom, $top, foo); exit;
[05:41][nick:~/monks]$ perl 1134136-2.pl Unquoted string "foo" may clash with future reserved word at 1134136-2 +.pl line 5.
Remember: Ne dederis in spiritu molere illegitimi!

In reply to Re^2: Optional quotes: to use or not to by 1nickt
in thread Optional quotes: to use or not to by hurricup

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.