On Apr 8, Bryan R Harris said:

>I read in a file, then strip all lines that start with "#" or "\n".  When I
>print them out, though, the first line is left justified correctly but the
>rest have a single space in front of them.  Any ideas why?

The reason is because you did:

>print "@comments";

`perldoc -q array` yields the question "Why do I get weird spaces when I
print an array of lines?" in perlfaq5.  Printing an array in quotes is the
same as doing

  print join($", @comments);

And the $" variable holds the string " " by default.  This means that
printing "@comments" does

  print join(" ", @comments);

which places a space in between each element... which "looks" like a space
in front of every line except the first.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to