Hello,
My background in "coding" stems from coding with the terrible PHP. As such, this has not been clearly exposed to me in the same way as some real concepts should be, as their policy seems to stem from "teaching by removing difficult details". As you can see, I'm attempting to adopt Perl as my main language, and feel I should familiarize myself with the philosophies in the concepts prior to that.
So my question to the experienced monks around here is:
What is the difference between an array and a hash as 'types', and why would it be a bad idea for them to be merged into the same data structure? In PHP, it is known as an associative array, where it is something like:
$array = array(1, 2, 3, 4);
$hash = array('red' => 1, 'blue' => 2', 'green' => 3, 'yellow' => 4);
+#hash
But in Perl, it is quite different. If possible, is an in-depth explanation in order?
I look forward to an answer to this question.
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.