On Sep 14, John_Kennedy said:

>print oBOTH "@UNLOCKED\n";
>
>How can I prevent the blank lines from the grep or how can I remove the
>blank lines from @UNLOCKED?

This was a recently-added question to the FAQ (in perlfaq5, under the
title "Why do I get weird spaces when I print an array of lines?").

The reason is that placing an array inside of double quotes interpolates
the list with a space in between each element[1].

That means if your array is ("abc", "def", "ghi"), printing it in double
quotes will yield "abc def ghi".  However, that ALSO means that if your
array is ("abc\n", "def\n", "ghi\n"), the output will be:

abc
 def
 ghi

Remove the quotes, and you should be fine.


[1] Technically, it uses the $" variable, whose default value is " ".

-- 
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 **


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

Reply via email to