Charles K. Clarkson wrote:
Gunnar Hjalmarsson wrote:
Siegfried Heintze wrote:
Consider the following program:

my $me;
$me->{verd_result}->[0][2]=5;
$me->{verd_result}->[0][5]=34;
print "len = ", [EMAIL PROTECTED]>{verd_result}->[0]}};
for (@{$me->{verd_result}->[0]}){
  print "\n v="; print;
}

It produces this output:

len = 5
 v=
 v=
 v=5
 v=
 v=
 v=34

No, it doesn't. It produces a fatal error.

I got four warnings:

Use of uninitialized value in print at aa.pl line 20.
Use of uninitialized value in print at aa.pl line 20.
Use of uninitialized value in print at aa.pl line 20.
Use of uninitialized value in print at aa.pl line 20.
len = 5
 v=
 v=
 v=5
 v=
 v=
 v=34

Hmm.. I checked again, and found the explanation: I'm running this kind of code snippets via CGI, having tainted mode enabled, and then the above code gives me:


    Bizarre copy of ARRAY in leave at ...

When removing the -T switch, I get the same as you.

The error message refers to the line:

    print "len = ", [EMAIL PROTECTED]>{verd_result}->[0]}};

and that line *is* bizarre. To get the last index in the array you should reasonably just do:

    $#{ $me->{verd_result}->[0] }

Actually, it's kind of strange that Perl does not object when the -T switch is not enabled. The explanation according to "perldoc perldiag" is that "Perl detected an attempt to copy an internal value that is not copyable", and it classifies it as an internal error you should never see...

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to