in reply to Putting an elemnt in first position in array.
Otherwise, and if you are sure the array contains the given element:@array[0..$ix] = @array[$ix, 0..$ix-1]
my $element = 'dog'; my $last = $element; for (@array) { ($_, $last) = ($last, $_); last if $last eq $element; }
|
|---|