change foreach() style to use key/item syntax

This lets us update the value in the original array.  In this case,
stripping off the pathname prefix before returning the array to the
caller.