Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Re: Re: Re: Re: correct usage of class attributes

by gjb (Vicar)
on May 05, 2004 at 15:02 UTC ( #350802=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re: Re: correct usage of class attributes
in thread correct usage of class attributes

Simple: $self->{friends} = ['John', 'Marie'];, or to add something to that list: push(@{$self->{friends}}, 'Jane');.

Same story for hashes: $self->{pets}->{dogs} = 'mike'

You may want to have a look at the tutorials on references and data structures in the perldocs (since the site is down, I can't link you now).

Hope this helps, -gjb-


Comment on Re: Re: Re: Re: Re: correct usage of class attributes
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://350802]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (16)
As of 2015-07-31 09:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (276 votes), past polls