KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I recently "needed" a zip function in Perl 5 (while I was thinking about How do I calculate relative time? ), i.e. a function that takes two lists and "zips" them together to one list, interleaving the elements. (Pseudo)example: @a=(1, 2, 3); @b=('apple', 'orange', 'grape'); zip @a, @b; # (1, 'apple', 2, 'orange', 3, 'grape'); Haskell has zip in the Prelude and Perl 6 has a zip operator built in, but how do you do it in an elegant way in Perl 5?
Tags (comma-separated)
Save Edits
Cancel