1

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?

2
  • Double-check the line number. You shouldn’t get that warning in the code you posted. Note that perl converts "foo$bar" into a concatenation ("foo" . $bar), but you don’t have code of that form either. Commented May 31, 2012 at 0:41
  • Triple checked the line number Use of uninitialized value in concatenation (.) or string at ./test.pl line 156. and here it is again 156 if ( @product_access == 1 ) Very weird... Commented May 31, 2012 at 0:46

1 Answer 1

6

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

Sign up to request clarification or add additional context in comments.

1 Comment

You are right! Warning suggests the problem is in the if statement while it is in one of the elsif Got the correct line number with 5.14.2 built for MSWin32-x86-multi-thread but incorrect line number with v5.8.5 built for sun4-solaris and also with v5.6.1 built for sun4-solaris-64int. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.