For a more complete discussion on Perl Value Types see
Advanced Perl Programming, but to prarphrase from page 329 of my copy
A scalar value (SV - arrays are AV, hashs are HV etc) will be made up internally of its current value, a count of the number of references to that scalar, and an internal bitmask that decribes the current 'type' or 'state' of the value. These types can be
- IV(integer value)
- NV(numeric or double)
- PV(string or pointer value)
- RV(reference)
- PV(A|H|C|G)V is for array|hash|code|glob
- PVMG for magic (blessed) references
So what you need, to get away from
0|value1|value2cruft is to force the scalar from type PV to IV
and _my_ favorite way to do this is
$value += 0;
this also my favorite way to trim leading zeroes from digit 'strings' - better than some regex's I've seen
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.