in reply to Re: Re: Printing an array in columns - improvements?
in thread Printing an array in columns - improvements?

Well, its not from the horses mouth, but heres a quick explanation.

Basically all Abigail-II is doing is conceptually breaking up the code by using the fat comma. Dont forget that semantically the => is equivelent to a comma (,) with the added nicety that if the item on the lhs is a bareword the bareword is automatically quoted.

print join " " => map {sprintf "%-${max}s" => $_} splice @array => 0, $cols;
is the same thing as
print join " " , map {sprintf "%-${max}s", $_} splice @array, 0, $cols;
as well as
print join(" ",map {sprintf "%-${max}s",$_}splice(@array,0,$cols));
The easiest to read is the first I think you'll agree. (although i dont know that i would have used a fat comma in the sprintf() call but whatever ;-)

Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.