I think the following is safe on unix platforms:
my $q_archive = quotemeta($ARGV[0]); my $q_filename = quotemeta($filename); system("tar $args $q_archive > $q_filename")
It can also be written as
system("tar $args \Q$ARGV[0]\E > \Q$filename\E")
quotemeta (called directly or via \Q..\E) will backslash-escape any non-word characters, so the file names can safely contain symbols and spaces.
In reply to Re^3: tar, system() & pipes?
by ikegami
in thread tar, system() & pipes?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |