perl_noob_101 has asked for the wisdom of the Perl Monks concerning the following question:
sub new_car { my $invocant = shift; my $class = ref($invocant) || $invocant; my $self = { color => "bay", legs => 4, owner => undef, @_, # Override previous attributes }; return bless $self, $class;
1. Is the variable "self" a hash?
2. I need a mix data types. Pair type data (like I have currently) and a few arrays as well (like store the IDs under each color}. Is it possible to add array type data to a class?
If you guys can point me to a good resource to read, that would also be helpful.
Thanks in advance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: arrays in classes
by chromatic (Archbishop) on Jun 08, 2011 at 21:19 UTC | |
|
Re: arrays in classes
by wind (Priest) on Jun 08, 2011 at 21:16 UTC | |
|
Re: arrays in classes
by locked_user sundialsvc4 (Abbot) on Jun 08, 2011 at 21:47 UTC | |
|
Re: arrays in classes
by perl_noob_101 (Initiate) on Jun 08, 2011 at 22:02 UTC | |
by GrandFather (Saint) on Jun 09, 2011 at 03:32 UTC |