qw is short for quoted words. It builds a list. So the code
($alpha,$delta)=qw/A D/; means: build a list with two elements A and D, and assign value A to $alpha, and value D to $delta.
In your example,
$test=q{qq{$delta and $alpha}}; is equivalent to
$test='"$delta and $alpha"'. Which means: give me a variable $test, and make the value equal to "$delta and $alpha" (with double quotes). When you evaluate this expression -
print eval ' "$delta and $alpha" ';
it is equivalent to the code -
print "$delta and $alpha";
Which will print "D and A" natually.
eval evaluates the value held inside the string given, "$delta and $alpha", in this case, which returns a scalar string.
In
Zaxo's example, he was doing -
print eval '$delta and $alpha';
which is equivalent to -
print $delta and $alpha;
which will print the value of $alpha. Note that in the second case, there is no double quote in the equivalent code.
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.