There's more than one way to do things | |
PerlMonks |
Re: Re: Fold a list using map splicesby hiseldl (Priest) |
on Feb 20, 2003 at 15:25 UTC ( [id://237114]=note: print w/replies, xml ) | Need Help?? |
I like the straightforward, but this expression could not be placed in a sub's parameter list because push does not return a list, rather it returns the number of new elements in the list. To clarify, this technique is used primarily to transform function parameters before they get passed. I could not use your two step method for that case. This technique is useful for creating HTML tables with N columns, where Tr() and td() both accept array refs. And, in order to fold the list without breaking stride, I used map. As a side note, I have been programming in Lisp for the last couple months, so I'll admit that this technique appears more functional than procedural. :-) -- P.S. A matter of opinion:
In Section
Cool Uses for Perl
|
|