use strict; my @array = ( 'angel', 'buffy', 'cordelia', 'dawn', 'ethan', 'faith', 'giles', ); reorder(5,'up'); # ethan moves up: swaps place with dawn display(); sub reorder { my ($item,$direction) = @_; ### Adjust index as arrays start at 0 $item--; # Down is here :) - you should add bounds checking! my $other = $direction eq 'up' ? $item - 1 : $item + 1; @array[$item, $other] = @array[$other, $item]; return; } sub display { print '-' x 30,"\n"; foreach my $key (0..$#array) { printf("%12s is now number %d\n",$array[$key],$key+1); ##Adjust key for display. } print '-' x 30,"\n"; } __END__ D:\Perl\test>test ------------------------------ angel is now number 1 buffy is now number 2 cordelia is now number 3 ethan is now number 4 dawn is now number 5 faith is now number 6 giles is now number 7 ------------------------------