|P is for Practical|
Annoying 'Use of uninitialized value in concatenation' warningby alain_desilets (Beadle)
|on Oct 25, 2011 at 19:47 UTC||Need Help??|
alain_desilets has asked for the
wisdom of the Perl Monks concerning the following question:
I have been using 'use strict' for years, but was only recently introduced to 'use warnings'. While I find it generally useful, it tends to generate warnings in contexts where I think it shouldn't, in particular when trying to print a variable whose value is undef.
For example, consider the following code:
This code prints the elements of an array, some of which have value undef. If you run it, you get error messages
"Use of uninitialized value $some_array2 in concatenation (.) or string at etc..."
Yet, it's perfectly fine for an array to contain some values of undef. Why shouldn't I be allowed to print them?
Is there a way around this issue? Thx.