while (@services) repeats the loop while the array isn't empty. It doesn't assign any element to any variable, and as you don't change the array in the loop, it runs forever.
for (@services) assings elemnts of @services to the implicit variable $_, one by one. After looping over all the elements (each element once), it stops.