my @arr = ( 1, 2, 3, 0x47 ); are numeric literals, see
Scalar value constructors. In the source code they can look like
12345 or
4_294_967_296 or
0xff or
0377 or
0b011011 and will all be converted to numbers and stored as numbers.
my @arr = qw/ 1 2 3 0x47 /; are strings, see
qw//, it's the same as writing
my @arr = ( "1", "2", "3", "0x47" );. In the source code,
0x47 is different from
"0x47", the first one means
71 and the second one is a string with four characters. Strings will only be automatically converted to numbers if they are plain integers. If you want to know if a string will automatically convert to a number, you can use
looks_like_number from
Scalar::Util.
"0x47" is not a plain integer, it's got an
x character. Use
oct to convert that string to a number,
oct it does octal,
0x123 and
0b101 formats, or use
hex which only does hexadecimal.
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.