troubleshooting Question

Perl - Array manipulation

Avatar of greenpath
greenpathFlag for United States of America asked on
Programming
2 Comments1 Solution485 ViewsLast Modified:
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
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros