in reply to Can you explain this error please?

Perl features Autovivification, which means that a variable that has no initial value is being used in a comparison, string concatenation, numerical operation, etc. Perl then replaces the variable with "" or 0 depending on what you are trying to do. Usually it means you have a typo in a variable, so $my_value and somewhere you may have used $my_alue. Or you do my $temp instead of my $temp = 0;

To isolate where the problem is occurring, try adding a block with the no warnings pragma:

use warnings; use strict; my $a = 5; { no warnings; # remove to see what happens print $a + $b; }

Replies are listed 'Best First'.
Re^2: Can you explain this error please?
by kennethk (Abbot) on Mar 01, 2016 at 20:28 UTC
    Autovivification is when perl creates records in a hash or array after dereferencing an undef. What you are describing is simply that an undef in string context is rendered as the empty string, just like an undef in numeric context is 0 and an undef in logical context is false.

    When turning off warnings, you should turn off the minimal set for your target scenario, e.g.

    { no warnings 'uninitialized'; # remove to see what happens print $a + $b; }
    Usually it means you have a typo in a variable,
    Except the OP said they have strict enabled, so in that scenario they would get a fatal error, not a warning. Which is why I asked the OP for a larger block of code to inform context.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.