while( <> ){ $j = int rand @array; @array[$.,$j] = ($array[$j],$_); } print @array;