Link to home
Start Free TrialLog in
Avatar of greenpath
greenpathFlag for United States of America

asked on

Perl - Array manipulation

Perl question:  How can I re-position a specific number of x records in an array (if my array contained 10 records of x & y data) as shown below.  For example, I would like to reposition a specific number of x-records (ie: 1-5 records) moving them to the end of the x column of the array, leaving the y column without change as new_array (below) shows?  

Thusfar: I've used push @array, splice($array[0],0,5); which moves 5 records of both x-y data.  
  Array
  X      Y
  1       2
  2       3
  3       4
  4       5
  5       6
  6       7
  7       8
  8       9
  9      10
  10    11
Output from new_Array
X   Y
6   2
7   3
8   4
9   5
10  6
1   7
2   8
3   9
4   10
5   11
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of greenpath

ASKER

Yes- thanks for the help!  Your solution works well, a bit cryptic and not too easy to read but does the answer my question.