in reply to Anonymous Scalar Ref to Hash?

Here is is with hash value error corrected and obvious use of @_.

sub new{ my $class = shift; # changed to take class off @_ my $self = $class->SUPER::new('1.0','UTF8'); # my $root; #unused my @listeners = @_; # assuming that's what you want $self->{'Listeners'} = [@listeners]; # hash value must be scalar bless($self, $class); }

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Anonymous Scalar Ref to Hash?
by bart (Canon) on Sep 05, 2002 at 07:27 UTC
    my @listeners = @_; # assuming that's what you want $self->{'Listeners'} = [@listeners]; # hash value must be scalar
    There's no need for copying. You can use a reference to the original array:
    $self->{'Listeners'} = \@listeners;
    A small thing, but something worth keeping in the back of your mind.