Get help on this challenge

Debugging9


Please read this explanation before attempting debugging challenges.


My Perl code seems to have an infinite loop...

my $a = 1;
my $b = 2;
my $c = 3;
my $string = "test".$a.$b.$c;

$string = mix_it($string);
print "$string\n";

sub mix_it {
my $string = shift;
my $check;
my @arr;
my @array = split('',$string);
my $d = scalar(@array)-1;
my $e = int(rand($d));


	while (scalar(@arr)<7){

	push(@arr,$array[$e]) unless $check eq $array[$e];
	$check = $array[$e];
	
	}
	
return join('',@arr);
}

Downloadable source code can be found here.


You must be logged in to play.



Challenge by clone4.