This is definitely an improvement.  One thing to note is that you can't use the foreach loop and ++$x, since foreach wil reset $x to the next value next time you go through the loop.  So this while would have to turn into a next if like so:
```perl
my $version_check = "";
foreach my $x (0..$#yum_response) {
  $version_check .= $yum_response[$x];
  next if $yum_response[$x+1] =~ /^\s+/;
  ...
  $version_check = "";
}
```