The high order concept here is Context. The two major contexts are list and scalar. For example, calling an array in list context returns a list of the values in the array; calling an array in scalar context returns the length of the array.
The parentheses following foreach are an indicator that you are calling your arguments in list context. From `STRING`:
In list context, returns a list of lines (however you've defined lines with $/ or $INPUT_RECORD_SEPARATOR), or an empty list if the command failed.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.