title: listing directories and sub-directories to an array with path;
body: <p>I need a listing of all directories and sub-directories stored in array using Perl.</p>
  
  <p>For example:</p>
  
  <pre><code>$array[0] = '/home';
  $array[1] = '/home/ali';
  $array[2] = '/home/perl';
  $array[3] = '/home/stackoverflow';
  $array[4] = '/home/ali/desktop';
  $array[5] = '/home/ali/sub';
  $array[6] = '/home/stackoverflow/new';
  </code></pre>