Search code examples
arraysperldereference

Uninitialized value warning at array length check


I have the following code:

my @product_access = @{ $products->{ $PosDetails->{"SalProductRef"}->[$i]}
                      {DetAccess_tab} };

if ( @product_access == 1 )
{
    $revenue{ $products->{ $PosDetails->{"SalProductRef"}->[$i] }{DetFinanceCategory} }
            {"Total"} += $PosDetails->{"SalSubTotal"}->[$i];
}

Right where I check the length of the array, I get a Use of uninitialized value in concatenation warning. It just seems a little odd to get that warning on that line. Why does it show this warning?


Solution

  • Some versions of perl will report some warnings in an elsif clause on the if line. I'm betting that's the case here.