Actually, that won't work.
You need this as the second line:
push @{$this->{fields}}, "some value";
push expects an array as its first argument, not an array reference, so
you need to dereference the value of $this->{fields}.
-Ton
-----
Be bloody, bold, and resolute; laugh to scorn
The power of man... | [reply] [d/l] |
That would have to be push @{$this->{fields}}, $val. push requires a @-value, not a reference to a @-value, as its first argument.
On a more general note, the way to think about an object in Perl is that it's a hash that knows how to call functions. So, if you want to push a value onto an array and a reference to that array is stored in the object, you treat it just like an array. Using bless just means it knows how to call functions in a given package. (There's a little more to it, but that's basically the gist.) | [reply] [d/l] |