Click here to get back home

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

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
FAQ 5.39 Why do I get weird spaces when I print an array of lines? PerlFAQ Server 03-16-2008
Posted by Ted Zlatanov on March 18, 2008, 12:21 pm
Please log in for more thread options

MD> wrote:

>> Note also that it doesn't just 'join' the elements but it also prints
>> them, which is obvious but still incorrect in the FAQ.

MD> What is "it"? It's not clear from the context, because print() does
MD> print them, but it's up to the double quotes a.k.a. qq() to join
MD> interpolated arrays.

MD> my $s = "@{[qw/foo bar baz/]}";
MD> print $s;

In the context of the FAQ that I quoted "it" was a single

print "@array";

line. That's why I made the correction s/join/print/. It's pedantic
and really not too important.

Ted

Posted by brian d foy on March 18, 2008, 5:16 pm
Please log in for more thread options

> The problem is that the simple FAQ answer is wrong exactly when people
> may be looking for reasons why there are weird separators in a list.

It's not wrong, it just isn't that good.

Posted by Ted Zlatanov on March 26, 2008, 5:27 pm
Please log in for more thread options


>> The problem is that the simple FAQ answer is wrong exactly when people
>> may be looking for reasons why there are weird separators in a list.

bdf> It's not wrong, it just isn't that good.

Do you want rewrite suggestions or will you do it?

Ted

Posted by brian d foy on March 27, 2008, 7:38 am
Please log in for more thread options

> wrote:
>
>
> >> The problem is that the simple FAQ answer is wrong exactly when people
> >> may be looking for reasons why there are weird separators in a list.
>
> bdf> It's not wrong, it just isn't that good.
>
> Do you want rewrite suggestions or will you do it?

It's already rewritten and commited to the repository.

Posted by benkasminbullock@gmail.com on March 18, 2008, 9:50 pm
Please log in for more thread options

> I think the FAQ should say:
>
> Saying
>
> print "@lines\n";
>
> prints together the elements of @lines with a space between them (unless
> $" has been changed from the default, see `perldoc perlvar').

That seems like a good idea to me.


Similar ThreadsPosted
FAQ 6.0: Why do I get weird spaces when I print an array of lines? December 18, 2004, 6:03 am
FAQ 6.0: Why do I get weird spaces when I print an array of lines? January 1, 2005, 6:03 pm
FAQ 6.0 Why do I get weird spaces when I print an array of lines? February 25, 2005, 6:03 am
FAQ 5.38 Why do I get weird spaces when I print an array of lines? May 8, 2005, 5:03 am
FAQ 5.38 Why do I get weird spaces when I print an array of lines? July 23, 2005, 10:03 pm
FAQ 5.38 Why do I get weird spaces when I print an array of lines? October 9, 2005, 10:03 am
FAQ 5.38 Why do I get weird spaces when I print an array of lines? December 15, 2005, 5:03 pm
FAQ 5.38 Why do I get weird spaces when I print an array of lines? December 22, 2005, 11:03 am
FAQ 5.38 Why do I get weird spaces when I print an array of lines? February 15, 2006, 12:03 pm
FAQ 5.38 Why do I get weird spaces when I print an array of lines? May 4, 2006, 9:03 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap