in reply to Newbie question No.2

Everyone has answered the why, but an easy way to get your desired result is to use join.
my @list = qw/The quick brown fox/; print join(" ", @list ), "\n";
outputs:
  The quick brown fox 

Replies are listed 'Best First'.
Re: Re: Newbie question No.2
by thor (Priest) on Jun 06, 2002 at 00:12 UTC
    an even easier way is to set $"=" ", which is the "list separator" (i.e. what character to use when a list is printed inside double quotes)
    $"=" "; @list = qw/The quick brown fox/; print "@list\n";

    thor

      The capital E Easier way is to join, just as yodabjorn suggested. If you go mucking about with $", you're liable to break things, due to the fact that $" is a global variable. Since that's like changing the value of pi, which would cause bridges to fall down, and dams to burst, somewhere else in that program there may be a piece of code that expects the default behavior and it won't work properly any more. join, of course, has no such "action at a distance".

      If you absolutely must do this, declare your $" to be local:
      local $" = " ";