How do you add an element on to an array within a class. I have the following class
package MyClass;
my @fields;
sub new
{
my $this = {};
$this->{fields}=undef;
bless $this;
return $this;
}
sub addValue
{
push $this->{fields}, "some value";
}
I know this is the incorrect syntax because I am getting an error. Can you use the oush method to add an element? If not, what is the best way to do this?
In reply to How do you add class array values by daveman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |