Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

backticks

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.

Synopsis

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

See Also

system, exec, open