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

Re: [ID 20000403.009] uninitialised concatenation???

From:
Tom Christiansen
Date:
April 4, 2000 08:27
Subject:
Re: [ID 20000403.009] uninitialised concatenation???
Message ID:
22384.954862017@chthon
>> "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
>that.

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
    anyway.)

--tom

PS: I note that the whiners haven't tackled the problem of line
    numbers and interpolation into HERE docs.



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