in reply to Piping into system commands
Of course, it's only a few lines to repeat this procedure in Perl if you wanted to avoid the system overhead entirely.system("cp", "file1", "file2") and die "..."; # system returns false +upon success, not true
Additionally, this statement is incorrect:
The || operator binds very tightly here (it has a high precedence), so if we were to use parenthesis just about everywhere we could, it would look a bit like this:print COPY "file1 file2" || die("Could not print to COPY: $!");
When making 'or'-type decisions based upon execution, you want to use a lower-precedence operator like 'or' instead of '||'. Only use || when you want to make a decision based upon values, and want to use $value1 || $value2.print COPY ("file1 file2" || die("..."));
|
|---|