Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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-

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://350802]
help
Chatterbox?
Discipulus is Corion reading 'Gory details of parsing quoted constructs'?..
[perldigious]: That's awesome erix. One of my work friends, who coincidentally convinced me to learn Perl originally, has a Finnish pen-pal. I showed him this and he immediately wanted to send it along to her.

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2016-12-06 16:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (112 votes). Check out past polls.