in reply to Re: Re: Printing an array in columns - improvements?
in thread Printing an array in columns - improvements?
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.
is the same thing asprint join " " => map {sprintf "%-${max}s" => $_} splice @array => 0, $cols;
as well asprint 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 ;-)print join(" ",map {sprintf "%-${max}s",$_}splice(@array,0,$cols));
Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.
|
|---|