I, like Flimsi, would also recommend Perl programming. As recent PHP for Perl converts itself, it taught me a lot of language.
The %
character is used to create a complete "associative array", as we might think about it. For example, I could create an associative array by doing the following:
%hash = ('key1' => 'value1', 'key2' => 'value2');
Then I could print it like this:
print %hash;
The result will be something like this:
'key2value2key1value1'
This, I believe, is called a "list context" because %
indicates that we are talking about a range of values.
On the other hand, if I wanted to access a single value, we would have to use the $
signal. This, as the Perl programmer tells us, can be thought of as an “S” for “Scalar”. We must use the $
sign whenever it comes to a singular value.
So, in order to access a single element in an array, I would have to use the following syntax:
print $hash{'key1'};
The same goes for arrays. A full array can be created as follows:
@array = ('abc', '123');
and then type like this:
print @array;
But to access one element of the array, I would instead type:
print $array[0];
There are many basic principles. You should familiarize yourself with the "list context" and the "scalar context" in detail. Soon, you'll also want to take a look at the links you use to create multidimensional structures in Perl. I would recommend "Perl Programming"! It was hard to read in chapters, but it certainly covers everything you need to know (and much more).