Re: How to merge multiple array elements

2012-01-16 Thread Igor Dovgiy
2012/1/15 Pradeep Patra > I want to merge more than 2 arrays. @array = (@array1,@array2,@array3,@array4); > print "Array elements:@array"; > > It works and displays 1-12. But I need something different because i > dont know the value of "n" beforehand. What do you mean by 'n'? Size of the f

Re: How to merge multiple array elements

2012-01-15 Thread Uri Guttman
On 01/16/2012 12:12 AM, Jeff Peng wrote: Consider the code below, though eval a string is considered bad way generally. eval string is bad generally? it is bad UNLESS you need it. and you don't need it here. the OP's problem is also very poorly stated. are the arrays related by name? if so,

Re: How to merge multiple array elements

2012-01-15 Thread Jeff Peng
于 2012-1-16 1:18, Pradeep Patra 写道: It works and displays 1-12. But I need something different because i dont know the value of "n" beforehand. So I decided to use a for loop. I tried push but it did not work. I would appreciate any help to merge multiple array elements preferably not using any l

How to merge multiple array elements

2012-01-15 Thread Pradeep Patra
Hi all, I want to merge more than 2 arrays. For example: @array1 = (1,2,3); @array2 = (4,5,6); @array3 = (7,8,9); @array4 = (10,11,12); my @array; @array = (@array1,@array2,@array3,@array4); print "Array elements:@array"; It works and displays 1-12. But I need something different because