"my" function not contained?

Since "my" is supposed to be "local" to the subroutine, why does Optiperl give these warnings: "my" variable $key masks earlier declaration in the same scope at line 487"

The script is called eauction.pl from EveryAuction. It is written with a lot of "my" functions that use the same name but in different subroutines, each like the lines below. There are a bunch of these that get the warnings.

The only thing that changes within the subroutine is the %cats number. Here is a partial copy of the first two problem lines.

473 my $key;
foreach $key (sort keys %Cats1) {

487 my $key;
foreach $key (sort keys %Cats2) {

If all of these lines are in the same subroutine, then I think that line 487 is unnecessary and also causing the problem.

18.05.2003. 05:26

This article hasn't been commented yet.

Write a comment




2 + 1 =