qx#

Synopsis#

my $output = `command`;
my $output = qx{command};
my @lines  = `command`;

Description#

Executes a shell command and captures its standard output.

Passes the command string to /bin/sh -c "..." for execution. In scalar context, returns the entire captured stdout as a single string. In list context, returns a list of lines (each including its trailing newline), split on $/ (input record separator).

After execution, $? (child error) is set to the child process wait status. Stdin is inherited from the parent so that interactive commands (e.g. tput) work correctly; stderr is also inherited.

See also#

system, exec, open