for (@rand) { if ( $rand[0]<0 ) { next; } else { shift @rand; } }