system
Executes an external command and waits for it to complete.
In the single-argument form, the command string is passed to
/bin/sh -c for shell interpretation (pipes, redirects, etc.).
In the multi-argument form (list form), the program is executed
directly via execvp without a shell, avoiding shell metacharacter
interpretation.
Returns the full wait status (same encoding as $?):
0on success (exit code 0)$? >> 8extracts the exit code- Lower 8 bits contain signal information
-1on failure to execute
The child process inherits Perl’s %ENV (not the OS environment).
Synopsis
my $status = system("ls -la");
my $status = system("program", "arg1", "arg2");
system("echo hello") == 0 or die "system failed: $?";