--- Nick Transier <[EMAIL PROTECTED]> wrote:
> Here is a basic attribute definition from an O'Reilly Book:
> 
> sub new { 
>       my $invocant = shift;
>       my $class = ref($invocant) || $invocant;
>       my $self = {
>                    color => "bay",
>                    legs => 4,
>                    @_ ,
>         };
>       return bless $self,$class;
> }
> 
> What I do not understand is why $self is not defined as a hash %self.

An object is a reference. %self would be a hash, but $self holds  the
anonymous hash reference returned by the {}.

> Also, if you were to only include @_, would you need a comma after it

Nope, but it's good style, in case you add more stuff later.

__________________________________________________
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/

Reply via email to