# Not portable to Windows sub shell_quote { my ($arg) = @_; $arg =~ s/'/'\\''/g; $arg = "'$arg'"; return $arg; } my $cmd = join ' ', map shell_quote($_), @CreateList; system("$cmd > data/test.txt") and die;