title: System command in perl
body: <p>I need to run a system command which would go to a directory and delete sub directories excluding files if present. I wrote the below command to perform this operation: </p>
  
  <pre><code>system("cd /home/faizan/test/cache ; for i in *\; do if [ -d \"$i\" ]\; then echo \$i fi done");
  </code></pre>
  
  <p>The command above keeps throwing syntax error. I have tried multiple combinations but still not clear how this should go. Please suggest. </p>