This entire if and while looks like it could be replaced with a foreach loop (```foreach my $x (0..@yum_response-1)```) and be significantly easier to read.  That would of course necessitate turning the inner while into an if/next combination.  Currently, this is very difficult to understand.

At the very least a comment on the inner while explaining what it does would be helpful.