Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by Anonymous Monk
on May 05, 2004 at 10:26 UTC ( [id://350787]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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

last question, I promise!!!

What about if I want something like: $self->{friends} and I want it to be a list or $self->{pets} and I want it to be a hash? like dogs->mike, charlie->cat mary, sal thanks so much!

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: correct usage of class attributes
by gjb (Vicar) on May 05, 2004 at 11:02 UTC

    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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://350787]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.