Sorry, but this is wrong. A leading minus in hash keys is so common that it has been special cased to not be interpreted as a mathematical operation when so used (Im not sure of the exact details of when it is legal). However the same is not true for +, nor is it true for an inline - of which I notice the OP has at least three.
# inline hyphens will cause problems
D:\Temp>perl -MData::Dumper -e "use strict; print Dumper({-leading_min
+us=>1,+plus=>1,in-line-minus=>1})"
Bareword "in" not allowed while "strict subs" in use at -e line 1.
Bareword "line" not allowed while "strict subs" in use at -e line 1.
Execution of -e aborted due to compilation errors.
# what happened to the plus?
D:\Temp>perl -MData::Dumper -e "use strict; print Dumper({-leading_min
+us=>1,+plus=>1,'in-line-minus'=>1})"
$VAR1 = {
'in-line-minus' => 1,
'-leading_minus' => 1,
'plus' => 1
};
# this works fine
D:\Temp>perl -MData::Dumper -e "use strict; print Dumper({-leading_min
+us=>1,'+plus'=>1,'in-line-minus'=>1})"
$VAR1 = {
'in-line-minus' => 1,
'-leading_minus' => 1,
'+plus' => 1
};
Cheers,
UPDATE:If in doubt use either Text::Quote->quote_key() or qw:
{qw(
-align CENTER
-valign TOP
-BGCOLOR blue
-font-color yellow
-FONT-FAMILY verdana,arial,helvetica
-FONT-SIZE 12
)}
--- demerphq
my friends call me, usually because I'm late....
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.