in reply to delete folder and its content with plain perl

ytjPerl:

Perhaps you could use:

system("cmd", "/c", "del", "-y", "C:\\Users\\tyj\\Documents\\Traning\\ +2017\\*");

The way you tried it wouldn't work because:

  1. del is a built-in command as part of the command shell, so system() won't find it.
  2. You're not taking the command-line quoting rules into account.

The (untested) system command I showed above tells Windows to run the command shell (cmd) for a single command (/c). The rest of the arguments are the ones you showed in your last example, but I fixed the backslashes for you.

As others have mentioned, it's not pure perl, or more precisely, it isn't portable across operating systems because we're shelling out to a command shell to do the work.

...roboticus

When your only tool is a hammer, all problems look like your thumb.