$_ is used if a variable is used in the function.
tests whether shift @array is true. It doesn't go through the values of @array.
says go through each value of @array. $_ stands for the current element for each step in the foreach.
$_ is used if the function in question searches through the the values of an @array or keys %hash.