On 7/14/07, Dr.Ruud <[EMAIL PROTECTED]> wrote:
snip
> Never use multiple print statements when you can use just one.
In general that's true, but because of the "Never" I have to object. :)
Sometimes multiple print statements look like only one, I am thinking of
the "print for LIST" construct.
print +(join "\n", @LIST), "\n" ;
print "$_\n" for @LIST;
I often use the way of the second one, but then like this:
{ local $\ = "\n"; print for @LIST }
(because it doesn't have to construct copies of the data).
I hardly ever go the join-way.
I was referring to writing, not calling, the print function. It is more of
a style/readability thing than an efficiency thing.
By the way, an easier way to write the join version is
print map { "$_\n" } @list;