in reply to Filling object arrays

You just have to dereference the array in your method body and you can do normal array operations like shift, pop, etc.

sub addThings { my ($self, @new_things) = @_; push @{$self->{things}}, @new_things; } sub getThings { my ($self) = @_; # If the caller expects a list, then dereference the array # before returning it, otherwise just return the reference. return wantarray ? @{$self->{things}} : $self->{things}; }
Of course you can use embedded hashes too if you can guarantee uniqueness of keys.


"The dead do not recognize context" -- Kai, Lexx