perlbaski has asked for the wisdom of the Perl Monks concerning the following question:
package CommonObject; my @common_array; package MyObject; @ISA = qw( CommonObject ); sub new{ my $class=shift; my $self = {}; bless $self, $class; $self->@common_array=qw(1 2);#This line throws syntax error return $self; }
How do i set array variables in parent class?
I know it has to do with $self being a reference to a hash. But I dont understand what happens if there are global scoped array variables in parent class. How do i access them or set them.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Data inheritance
by ikegami (Patriarch) on Sep 23, 2011 at 18:17 UTC | |
by perlbaski (Sexton) on Sep 23, 2011 at 21:00 UTC | |
by ikegami (Patriarch) on Sep 23, 2011 at 21:04 UTC | |
by perlbaski (Sexton) on Sep 23, 2011 at 21:15 UTC | |
by ikegami (Patriarch) on Sep 23, 2011 at 21:17 UTC | |
by perlbaski (Sexton) on Sep 23, 2011 at 21:27 UTC | |
by ikegami (Patriarch) on Sep 23, 2011 at 22:47 UTC | |
by perlbaski (Sexton) on Sep 23, 2011 at 21:12 UTC | |
by ikegami (Patriarch) on Sep 23, 2011 at 21:13 UTC | |
|
Re: Data inheritance
by ikegami (Patriarch) on Sep 23, 2011 at 18:26 UTC | |
by perlbaski (Sexton) on Sep 23, 2011 at 18:44 UTC | |
by ikegami (Patriarch) on Sep 23, 2011 at 19:31 UTC | |
by perlbaski (Sexton) on Sep 23, 2011 at 20:44 UTC | |
by ikegami (Patriarch) on Sep 23, 2011 at 21:00 UTC | |
|
Re: Data inheritance
by SuicideJunkie (Vicar) on Sep 23, 2011 at 18:21 UTC |