use List::Util qw[shuffle]; $m = 65; $n = 100; @list = ( (1) x $m, (0) x ( $n - $m ) ); @list = shuffle @list;