Lets take the following example:
package Farm; use strict; use warnings; sub new { my $className = shift; my $self = { $farmName,"", "farmMamals",(), "farmBirds",() }; bless $self,$className; return $self; } sub addFarmBirds { my self =shift; my tempBirds=[] ; # right way of initialising an array ?? if (@_){ @tempBirds=@_}; #now for the part i dont understand $self->{farmBirds} = @tempBirds; return } }
Here my intention is to declare a hash of variables that belong to the specific object (forgive my poor terminology, still trying to get the gribs of it). From what i understand farmBirds is declared as an array (not a reference to one).
If i now call myFarm->addFarmBirds(@someFarmBirdsArray) will that array's items be placed inside the farmBirds array internal to the object "myFarm"? Or are the variables i declared in the class Farm stored as references?
will something like
my @birds = $self->{farmBirds};
successfully make a copy of the farmBirds array in the @birds array? It doesnt not appear to be the case, any ideas on how i can make that happen?
In reply to Help!!!! POOP is confusing me! by bittis
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |