[VPM] Re: Help in reference
Philip Yuson
plyuson at conceptsolutionsbc.com
Thu Dec 2 17:59:04 CST 2004
Sorry, build is:
sub build {
my $self = shift;
my $a = []; # <-- This changed
return $a;
}
Philip Yuson wrote:
> I am having a problem with a script.
>
> The script defines two instaces of a class ($o an $j of package parse)
>
> The parse package defines an array reference. For some reason, it
> defines the same reference address for both packages:
>
> Ex:
>
> package x_parse;
>
> sub new {
> ...
> }
>
> sub build {
> my $self = shift;
> my $a = ();
> return $a;
> }
>
>
>
> use strict;
>
> my $o = new x_parse;
> my $j = new x_parse;
>
> my $o_a = $o->build;
> my $j_a = $j->build;
>
> if you print $o_a and $j_a, they both have the same reference address:
> ex: ARRAY(0X94ce680)
>
> The build method is a lot complicated but I just shortened it.
>
> Is this a bug in Perl or is this a bug in my program?
>
> Thanks.
>
>
--
=======================
Philip L. Yuson
Senior Consultant
Concept Solutions Corporation
Phone: (250) 881-0049
Fax (250) 381-2425
More information about the Victoria-pm
mailing list