develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [ID 20000330.052] Use of uninitialized value in concatenation (.)

From:
Tom Christiansen
Date:
March 30, 2000 19:54
Subject:
Re: [ID 20000330.052] Use of uninitialized value in concatenation (.)
Message ID:
13664.954474857@chthon
>This is a bug report for perl from hermit@komodo.bayview.com,
>generated with the help of perlbug 1.28 running under perl v5.6.0.

>-----------------------------------------------------------------
>The warning message that appears when you use an uninitialized variable
>in string interpolation (double quotes) is wrong.  It says "Use of
>uninitialized value in concatenation (.)" when in fact there is no
>concatenation (.) operator on that line.  Instead, there is double-quoted
>string interpolation.  The warning message is misleading, as novice
>users might go looking for a concatenation operator (a .  between two
>scalar values) when in fact the problem is with something different.

That is, however, what's happening:

% perl -MO=Deparse,-q -e '@scalar = @array = (1..10); print "this $scalar and that @array\n"'
@scalar = (@array = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
print 'this ' . $scalar . ' and that ' . join($", @array) . "\n";

--tom



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About