Ok, I'm not sure if the above title made sense, here is what I am trying to do:
Suppose I am writing a module that looks something like this:
package Whatever;
use strict;
use warnings;
#constructor--will take one argument when called
sub new {
my $class = shift;
my $name = shift;
my $self = { name => $name, items => {[]}, };
return bless $self, $class;
}
My question is, how to put values into the 'items' portion, I have tried writing a method like this:
sub add {
my $self = shift;
my $key = shift;
my @values = @_;
%{ $self->{items} {$key } = @values };
}
I know, because of assignment parameters, that the key to the hash will always be the first item of @_ (after the class name) . Can someone give me a hand with this?