in reply to sub functions, and strings

If you return concatenated first and second argument, why pass a third argument to the function? If you want to pass the third argument "by reference," pass a reference to the scalar (remember that Perl only passes parameters by value). Then you will be able to say something like
$$returnstring = $a . $b;

Also, you might want to re-phrase your question.

Replies are listed 'Best First'.
Re: Re: sub functions, and strings
by FamousLongAgo (Friar) on Nov 11, 2002 at 20:58 UTC
    Perl doesn't exactly pass by value -- you can modify the calling arguments by monkeying with the values of @_.

    All that seems needed here is :
    sub concat { join '', @_ } my $joined = concat( $first_part, $second_part );


    Updated to remove misplaced rant about symbolic references - see below.
      Why the symbolic reference?
      Huh? He didn't say anything about symbolic references. He said "references", and his illustration was as valid for hard references as symbolic ones.

      jdporter
      ...porque es dificil estar guapo y blanco.

        You're right - it was just such a weird way to modify an argument that it threw me for a loop. It still risks weird symbolic reference behavior if you accidentally assign a scalar instead of a scalar ref to that variable, so I'll stick to my guns( albeit with less tenacity ).