Function that combines two lists by alternatingly taking elements

@arr1=('a','b','c'); @arr2=(1,2,3); @buf; for ($k=0;$k<scalar(@arr1);$k++) { push(@buf,$arr1[$k].','.$arr2[$k]); } print join(',',@buf);
example: given the two lists [a, b, c] and [1, 2, 3], the function should return [a, 1, b, 2, c, 3].

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.