On 03/09/2011 12:22, Ron Weidner wrote:
I'm trying to add a object to an array of objects. The code below is wrong. sub add_widget { my $self = shift; my $new_widget = shift; push ( @($self->{WIDGETS}), $new_widget ); }
Hi Ron You probably want push @{$self->{WIDGETS}}, $new_widget;
Later, I'm going to need to iterate over the array of widgets. How can I accomplish these 2 tasks?
Simply foreach (@{$self->{WIDGETS}}) { : } HTH, Rob -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/