|
|
| XP is just a number | |
| PerlMonks |
Re: correct usage of class attributesby gjb (Vicar) |
| on May 05, 2004 at 13:59 UTC ( #350770=note: print w/ replies, xml ) | Need Help?? |
|
There's two things: class attributes and object attributes. The former have the same value for each object of that class, the latter have values specific to each object. Setting a class attribute $string in method Function10 would be done by simply assigning a value to it, e.g. $string1 = "Hi there";. This assignment is kind of global to all instances of the class. Setting the attribute of an object would be done by $self->{attr_name} = $attr_vallue;. This assignment is specific to the object you called the method on. Hope this helps, -gjb-
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||