in reply to Re: Using Subroutine Returns
in thread Using Subroutine Returns

So complicated and ugly! Just concatenate it with the '.' operator.

Replies are listed 'Best First'.
Re^3: Using Subroutine Returns
by almut (Canon) on Apr 23, 2009 at 09:53 UTC
    So complicated and ugly!

    That's true, of course... but some people just want to interpolate :) — I have to admit I've also felt that urge at times...

    This is probably the outcome of the generalizing behavior of our brains: we've learnt we can interpolate scalars and arrays, so why not also hashes, functions, anything?  (This behavior, in and of itself, is certainly a Good Thing, BTW, otherwise we probably wouldn't be where we are today, messing with Perl... supported by those little silicon chips, etc.)

    Also, some people just find

    "abc ${\config('username')} xyz";

    easier to read/type than

    "abc ".config('username')." xyz";

    even though they are exactly the same number of chars.

    Anyhow, the nice thing is that with Perl's TIMTOWTDI-ness, everyone can get happy :)

Re^3: Using Subroutine Returns
by doug (Pilgrim) on Apr 23, 2009 at 17:30 UTC
    It is in a print, so a comma would be more natural than a dot. There is no need to build a single scalar when the operator takes a list.
    print config('username'), " is my username";
    Most likely the OP would want a \n in there too, but that isn't really part of the interpolation question.