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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|