Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^3: Creating a unique variable typeby topher (Scribe) |
on Mar 25, 2013 at 23:21 UTC ( [id://1025411]=note: print w/replies, xml ) | Need Help?? |
Technically, you are correct. An array value can only hold a scalar variable. However, there are a couple of ways you can work around that. The most common is references. Instead of storing an array inside of another array, you store array references (which are scalar values) in your array. The easiest way would be an array of array references:
A brief example of using an array of array references:
Giving us the following output:
For more information on nested data structures using references, you should check out perlreftut and perlref.
Christopher Cashell
In Section
Seekers of Perl Wisdom
|
|