while (my $item = shift @toprocess)