in reply to Re^2: tar, system() & pipes?
in thread tar, system() & pipes?
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 Section
Seekers of Perl Wisdom