success1124 has asked for the wisdom of the Perl Monks concerning the following question:
I have an array , and i want to put an element if present in that array to the first position. How to do this.
For example if my array isand if my required element is dog, then my final array should be dog,apple,ball,cat,elephant.my @array = ("apple","ball","cat","dog","elephant");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Putting an elemnt in first position in array.
by marto (Cardinal) on Jun 14, 2010 at 10:44 UTC | |
|
Re: Putting an elemnt in first position in array.
by JavaFan (Canon) on Jun 14, 2010 at 10:48 UTC | |
|
Re: Putting an elemnt in first position in array.
by salva (Canon) on Jun 14, 2010 at 11:35 UTC | |
|
Re: Putting an elemnt in first position in array.
by johngg (Canon) on Jun 14, 2010 at 14:26 UTC | |
|
Re: Putting an elemnt in first position in array.
by ikegami (Patriarch) on Jun 14, 2010 at 16:11 UTC | |
|
Re: Putting an elemnt in first position in array.
by Utilitarian (Vicar) on Jun 14, 2010 at 11:12 UTC | |
|
Re: Putting an elemnt in first position in array.
by ahmad (Hermit) on Jun 14, 2010 at 13:19 UTC |