Perl Programming/Keywords/qx

Previous: qw Keywords Next: rand

The qx keyword edit

qx is a command that contains a string that may be interpolated. It is then executed as a system command with /bin/sh or similar. Wildcards, pipes, and redirections of the shell are taken into account. The collected standard output of the command is returned, and standard error remains unchanged. In scalar context, it comes back as a single string that may be multi-lined, or an undef, if the command failes. In list context, it returns a list of lines (however you've defined lines with $/ or $INPUT_RECORD_SEPARATOR), or an empty list, if the command failes.

Syntax edit

Previous: qw Keywords Next: rand