in reply to Randomising an array
If this is for a class project or a nuclear power plant I wouldn't do it this way:
@a = (0..20);$,="\n"; for(0..200){$b=shift @a;push @a,(int rand 2)?($b,shift @a):(shift@a,$b +)} print @a; [download]