[VPM] Help in reference

Peter Scott Peter at PSDT.com
Fri Dec 3 13:18:56 CST 2004


At 5:32 PM -0800 12/2/04, Darren Duncan wrote:
>On Thu, 2 Dec 2004, 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:
>>
>>  sub	build {
>>	my $self = shift;
>>	my $a = [];
>>	return $a;
>>  }
>>
>>  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?
>
>Does this bug still occur in your shortened version?  If it does,
>then...
>
>Try renaming $a to
>something else.  The names $a and $b have special meanings to Perl, like
>$_ does, though possibly only in certain contexts like explicit sorting.
>See if it works with a name like $foo instead of $a.

The way it's written that isn't going to make any difference. 
Something got changed in the process of summarizing the problem for 
the list, 'cos what's shown can't cause the problem and I really 
doubt it's a bug in Perl.

We need to see the shortest version of the code that actually 
demonstrates the problem.


More information about the Victoria-pm mailing list