Re: Academic name for associative array when used to pair column names with data
Date: Wed, 19 Mar 2014 18:15:45 -0700 (PDT)
Message-ID: <b39b9d03-ef55-4b2e-90b8-4e4d2c7bed08_at_googlegroups.com>
On Tuesday, March 18, 2014 7:47:26 PM UTC-7, william.d..._at_gmail.com wrote:
> my _at_column_names = qw/color season sound/;
> my _at_data = (
> [ qw/blue fall loud/ ],
[...]
> );
> foreach my $tuple ( _at_data ) {
> my %name_needed
> = map { $column_names[$_] => $tuple->[$_] } 0 .. $#column_names;
> }
[Off topic insofar as I'm just asking about perl code but...]
Why $column_names not _at_column_names? (Ditto for $# vs @#.)
Ok _at_#column_names is the max index starting from 0 but what if there are no words in @column_names? Do you understand that there are two relations with the empty set of attribute names? What if there are no (pointers to) arrays in @data? Do you understand that there are relations with no tuples?
philip Received on Thu Mar 20 2014 - 02:15:45 CET