in reply to Confused about "unitialized value" warning

Start by finding out which var is undefined, then keep backtracking.

print STDERR ('$row[0]: ', defined($row[0])?1:0, "\n"); print STDERR ('$row[1]: ', defined($row[1])?1:0, "\n"); print STDERR ('$matrix[$ab]: ', defined($matrix[$ab])?1:0, "\n"); print STDERR ('$matrix[$ab][3]: ', defined($matrix[$ab][3])?1:0,"\n"); print STDERR ('$total_packages: ', defined($total_packages)?1:0,"\n"); push(@MASTER, $row[0].":".$row[1].":$matrix[$ab][3]:".$total_packages. +"AI"); last SWITCH; }

(row[0] should be $row[0])

Replies are listed 'Best First'.
Re^2: Confused about "unitialized value" warning
by xspikx (Acolyte) on Aug 18, 2004 at 17:02 UTC
    It looks like i have to play with my variable. Since it is a multi dimensional array, in some lines I tried using ${matrix}[$ab][0] and on others @{matrix}[$ab][0] and it seems like it starts to work
      You shouldn't have to use '@' there. It's very confusing to read, at the very least.
        Lets say if I have a variable that is supposed to look like this: Evan_PARTNERS and I'm trying to declar it by using the matrix variable, why is that in some cases I have to use $ and some cases @? ${matrix}[$ab][3]{_PARTNERS} @{matrix}[$ab][3]{_PARTNERS}