This function is a alternative to using back-quotes to execute system commands. For example, qx(ls -l) will execute the UNIX ls command using the -l command-line option. You can actually use any set of delimiters, not just the parentheses.
Following is the simple syntax for this function −
This function returns the value from the executed system command.
Following is the example code showing its basic usage −
#!/usr/bin/perl -w # summarize disk usage for the /tmp directory # and store the output of the command into the # @output array. @output = qx(du -s /tmp); print "@output\n";
When above code is executed, it produces the following result −