Perl

Perl: How to Construct "Array of Array" Data Structure

Submitted by admin on Mon, 04/18/2016 - 12:06

How can we express the data structure of "Array of Array" in Perl? Usually we create a generic array in Perl like this: @array = ('aaa', 'bbb', 'ccc'). Please take a look at the sample code shown below.
Note that a vaiable $songs starts with '$'. Also note that parenthesis is [...], not (...), even it is inside the parenthesis. This is to express a "reference" of "Array of Array". Take a look at "foreach" for accessing the reference variable.
 
#!/usr/bin/perl

Tags