in reply to Read And modify a series
I have an array Say, #array1 = qw (1,1,1,2,3,4,4,4,5,6,1,1,1). From this array i have to extract an output as "1,1,1,2,3,4,4,4,5,6" (i.e. to remove the number of 1's from the end alone).
But that's not the same thing as finding unique values...?
If you have an array, say my @array1 = (1,1,1,2,3,4,4,4,5,6,1,1,1);, one way to remove the 1's from the end is like this: pop @array1 while $array1[-1]==1;, but that might be inefficient if you have a large number of 1's at the end of the array.
For help with your code, please make it more readable by adding <code> tags.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Read And modify a series
by DarshanS (Initiate) on May 26, 2015 at 11:10 UTC |