Why do I get weird spaces when I print an array of lines?

Saying

    print "@lines\n";
joins together the elements of @lines with a space between them. If @lines were ("little", "fluffy", "clouds") then the above statement would print

    little fluffy clouds
but if each element of @lines was a line of text, ending a newline character ("little\n", "fluffy\n", "clouds\n") then it would print:

    little
     fluffy
     clouds
If your array contains lines, just print them:

    print @lines;

Back to perlfaq5