PERL: Inserting element into array
-
Lets say I have a 5-element array such as @array = (1,2,3,4,5). Is there a function or some quick way insert element "100" into the 3rd position such as (1,2,100,3,4,5)? I cannot find a way to use an index to reference an array element. Another example: If I have an array with (1,2,100,6,4,100,3,100), how can I quickly sort it to (1,2,100,100,100, 6,4,3)? Please help. Thanks.
-
Lets say I have a 5-element array such as @array = (1,2,3,4,5). Is there a function or some quick way insert element "100" into the 3rd position such as (1,2,100,3,4,5)? I cannot find a way to use an index to reference an array element. Another example: If I have an array with (1,2,100,6,4,100,3,100), how can I quickly sort it to (1,2,100,100,100, 6,4,3)? Please help. Thanks.
Hi, Check http://www-2.cs.cmu.edu/People/rgs/pl-exp-arr.html You'll find all the functions you can use for arrays. Have fun! :) ----- We are what we repeatedly do. Excellence, then, is not an act, but a habit.
-
Hi, Check http://www-2.cs.cmu.edu/People/rgs/pl-exp-arr.html You'll find all the functions you can use for arrays. Have fun! :) ----- We are what we repeatedly do. Excellence, then, is not an act, but a habit.
Florin Ochiana wrote: We are what we repeatedly do. Excellence, then, is not an act, but a habit. Nice sig! :-D
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi -
Florin Ochiana wrote: We are what we repeatedly do. Excellence, then, is not an act, but a habit. Nice sig! :-D
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma GandhiAristotle said it first :) ----- We are what we repeatedly do. Excellence, then, is not an act, but a habit.