Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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?
[holli]: meh, i never get used to this keyboard
[holli]: i didnt pay attention when i bought it. it's one of those where backspace is just one unit wide
[holli]: in what way improved?
[ambrus]: I may have ruined my good keyboard on Friday by spilling tea in it. I hope it's just temporarily malfunctioning until it dries out, but I fear it might be permanently damaged.
[holli]: did you soak the controller boardlet?
[Eily]: could be worse, you might have ruined your tea with the content of the keyboard
[holli]: if you didnt you should be fine
LanX .oO( holli needs standards which are standardized!!)
[holli]: do i?
[holli]: oh for the keyboard

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (12)
As of 2017-11-21 13:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (302 votes). Check out past polls.

    Notices?