title: Perl - create and automate a hash table with arrays as the values
body: <p>im trying to achieve the following:</p>
  
  <p>I have a txt file with a random list of files,
  I want to sort the files by their path.</p>
  
  <p>for eample:
  The list is:</p>
  
  <pre><code>c:\foo\bar\bbb.txt
  c:\foo\bar\ccc.txt
  d:\xxx\eee.txt
  c:\foo\bar\aaa.txt
  d:\xxx\ddd.txt
  </code></pre>
  
  <p>i want the data like this:</p>
  
  <pre><code>[KEY]
  c:\foo\bar
  [Values]
  aaa.txt
  bbb.txt
  ccc.txt
  
  [KEY]
  d:\xxx\
  [Values]
  ddd.txt
  eee.txt
  </code></pre>
  
  <p>i thought of using a hash map, with arrays as the values.
  i couldnt figure out the currect syntax.</p>
  
  <p>this is some of my code:</p>
  
  <pre><code>open (FILELIST, "$file") or ...;
  my @filelist = &lt;FILELIST&gt;;
  my %uniqueFolders;
      foreach $fileList_line (@filelist)
        {
           my $file = (File::Spec::Win32-&gt;splitpath($fileList_file))[1];
             if ( !$file ~~ @temp = keys %uniqueFolders)
               {
                   %uniqueFolders{$file} = ????????????
  
                }
  </code></pre>
  
  <p>how do i access the array to add/read from it?</p>
  
  <p>and how can i automate it so the arrays are created when needed..</p>
  
  <p>Help,</p>
  
  <p>Thanks.</p>