$ perl -V:sh sh='cmd /x /c'; #### #!/usr/bin/perl -- use strict; use warnings; use Capture::Tiny qw/ capture /; my @cmd = ( ## C:\WINDOWS\system32\cmd.exe qw( cmd.exe /x /c dir /b /s /o:-d ), "an y dir ect o ry" ); my($stdout, $stderr, $exit) = capture { system { $cmd[0] } @cmd; };;