Archive - Originally posted on "The Horse's Mouth" - 2005-03-09 17:37:09 - Graham Ellis
IT without boundaries So say the coffee mugs where I'm training this week - a company motto that seems very appropriate when I'm teaching about Perl's lists. Most languages allow you to define a whole series of values in a single variable (an array), but if you're writing in C or Java, you're probably used to having to define the number of elements, and the size of each element, ahead of time. Perl is different - with Perl lists you can simply refer to the list for the first time and it will be created, and you can save as many values as you like into it and the list will be extended as need be to handle your request.
I must be fair to C and Java, though. In C, you can use calloc, malloc and realloc to dynamically assign memory if you wish and Java's Vector and ArrayList classes also let you set up a dynamic container in a similar way in that language.