On 2/27/09 Fri Feb 27, 2009 5:21 AM, "Bill Harpley" <bill.harp...@ericsson.com> scribbled:
> Suppose I have a multidimensional array of the form: > > @array[names][values] There is no such construct in Perl. An array is a one-dimensional list of scalar values, indexed by integers. You can emulate multi-dimensional arrays by setting each member of your array to an array reference: $array[0] = []. However, the arrays need not be the same length, and the indices are still integers, not field names. > > For example, I have a list of database field names and the value > associated with each one. A list of field names and associated values could be stored in an array of arrays thusly: @array = ( [ 'field1', 'value1'], ['field2', 'value2'], [...], ... ); However, a hash would be a more appropriate data structure to use for this purpose. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/