If you come around something like
{}
you might think it is an empty block, but it isn't.
Try the following:
perl -e '{};{}' # works
perl -e '{1}{}' # works
perl -e '{}{1}' # works
perl -e '{}{}' # doesn't work
Why? Because {} can be meant as an empty block or as an hashref, and to perl, those are two hashrefs.
perl apparently "uses fuzzy logic to guess whether you meant a {} to be a block or a hash-ref. It assigns points based on the surrounding code and the stuff inside the {} and then picks based on the resulting score" (this information courtesy of samtregar).
To see what happens for yourself, try this
perl -MO=Terse -e '{};{}'
This {} thing is actually a bug in perl. After all, you give it well written code and it complains about a syntax error.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.