in reply to Putting an elemnt in first position in array.

Using unshift and splice in a loop will do the trick in this special case as we are not changing the size of the array so the subscript isn't mucked up.

$ perl -E ' > @arr = qw{ apple ball cat dog elephant fish dog budgie }; > for ( 1 .. $#arr ) > { > unshift @arr, splice @arr, $_, 1 if $arr[ $_ ] eq q{dog}; > } > say for @arr;' dog dog apple ball cat elephant fish budgie $

I hope this is helpful.

!-- Node text goes above. Div tags should contain sig only -->

Cheers,

JohnGG