in reply to Can someone explain how this works?

This executes the command contained in $cmd, using shell redirection techniques to feed the output of STDERR into STDOUT, which is read into this program through the RS filehandle. A fuller description of what is occurring can be found in the documentation for the open() function (which can also be found by executing 'perldoc -f open' on most systems.

(One additional note-I would hope that $cmd does not come from an untrusted source, such as user input from a web form. If so, then there could be the potential for security issues.)

Hope that helps.

  • Comment on Re: Can someone explain how this works?