While you are quite right that the exec function in perl can be
used to execute a command, it is seldom used by itself. Usually it
is preceded by the fork function call.
To execute a program and fetch it's output, I would rather suggest either
using the qx() construct or doing it by hand, open(F, "program|").