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

Re: [ID 20000403.009] uninitialised concatenation???

Tom Christiansen
April 4, 2000 08:27
Re: [ID 20000403.009] uninitialised concatenation???
Message ID:
>> "String interpolation is a form of concatenation."  I'm sure it
>> says that somewhere.

>I'm not sure it does...  I looked through perlop and grepped all the pod
>for 'interpo' and 'concat' on the same or adjacent lines, but didn't find

Found it.  Blue Camel, rendered into pod for simple reading:

    Note that Perl I<does not> place a space between the strings
    being concatenated.  If you want the space, or if you have more
    than two strings to concatenate, you can use the C<join> operator,
    described in chapter 3, "Functions".  Most often, though, people
    do their concatenation implicitly inside a double-quoted string:

	$fullname = "$firstname $lastname";

>Anyway, why shouldn't it say that in the warning message as well?  If we
>want to educate people that string interpolation is the same as
>concatenation, that seems like a good place to do it.

Perhaps somewhere one could say something like this:

    This means that you can insert the values of certain variables
    directly into a string literal.  It's really just a handy form
    of string concatenation. (With warning enabled, Perl reports
    undefined values interpolated into strings as using the
    concatenation or join operations.  Even though you don't actually
    see those operators there.  The compiler created them for you


PS: I note that the whiners haven't tackled the problem of line
    numbers and interpolation into HERE docs. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About