Your data structure doesn't look like you think it does. Values can't be arrays. They have to be references.
Here's some similar code that may help you get going better. I also threw in a little use of Data::Dumper since it can be handy to figure out what what your data structures look like.
use warnings;
use strict;
use Data::Dumper;
my $primary_features = {
foo => [ 'fool', 'food', 'foot', ],
bar => [ 'barricade' ]
};
print Data::Dumper::Dumper( $primary_features );
while (my ($key, $value) = each(%$primary_features)){
print "($key, $value)\n";
}
Also, note a few things:
- I used => instead of ",". They're almost the same, except => puts whatever is to the left of it in quotes, and it's traditionally used to separate the keys and values of things in hash definitions.
- I made a reference to an array with square brackets instead of parentheses. You can make an array with the qw() operator, so qw( fool food fort ) is the same as 'fool', 'food', 'fort' , and may be easier to type.
- When you print out $value, it's going to show something like "ARRAY(0x10080fe18))" that means you're trying to print an array. You can iterate over your array or something like that to print something more useful.
- use warnings and strict. They help you find when you're typing something that doesn't make sense.