in reply to A simple,

First off, thanks everyone for the good explanations. I'll read up more on the join function. And also in what situations I'm forcing a list into a scalar context.

Second, the title was meant to say, 'A simple, "why?"' but the HTML overlooked the quotes when rendered. Oops -- is there an HTMLmonks.org? Haha...

Lastly, two more questions!

  1. Why then, don't I see a space on the print out with my second version? My guess is that it is there - albeit at the end and therefor not seen?
  2. Why did my second version reverse the element, i.e. THIRD => DRIHT, and also reverse the list? Almost as if I used two reverse statements; first one in a scalar context, then a second on the list itself.

Again, thanks everyone for the help.

-- Just another Perl slacker
Steampunk.

Replies are listed 'Best First'.
(kudra: answer on the reverse list thingie) RE: Thanks!
by kudra (Vicar) on Oct 04, 2000 at 20:39 UTC
    In answer to number 1, the space is still there. You can easily confirm your theory by adding a line like:
    print "-\n";
    after you print the list. The space should be quite obvious then.

    As for your second question, remember: "concatenates all the elements of LIST together and then returns the reverse of that, character by character." So first your list becomes "firstsecondthird" (a short version of it), then that is reversed to "driht...".