title: Perl Foreach through Multidimensional Array?
body: <p>I have a script that takes pathnames/files that are too old (as decided via user input) and deletes them. I want to list each directory separately and ask for confirmation of deleting the old files in each directory.</p>
  
  <p>So, I have an array (@oldDirs) that holds multiple arrays (each directory), which hold strings (the fullpath names).</p>
  
  <pre><code>@oldDirs = (@AirDefense,@Arcsight,@Avocent,@BlueCoat,@Checkpoint,@Cisco,@Crossbeam,@FireE ye,@lostAndFound,@rancid,@Riverbed,@Symantec,@Wiki,@WLAN)
  
  if($oldPathsSize != 0)
  {
      my $dirNamesCounter = 0;
      my @dirNames =     ('/AirDefense','/Arcsight','/Avocent','/BlueCoat','/Checkpoint','/Cisco','Crossbeam','FireE ye','/lost+found','/rancid-2.3.8','/Riverbed','/Symantec','/Wiki','/WLAN');
      foreach my @direc (@oldDirs)
      {
          my $size = @direc;
          print "Confirm Deletion of $size Old files in $dirNames[$dirNamesC]: \n";
          $dirNamesCounter++;
  
          foreach my $pathname (@direc)
          {
              print "\t$pathname\n";
          }
  
          print "\nDelete All?(y/n): ";
          my $delete = &lt;STDIN&gt;;
          chomp($delete);
  
          if($delete eq "y")
          {
             #delete file
          }
      }
  }
  </code></pre>
  
  <p>My issue is with the first foreach statement.  Both are arrays and @direc isn't allowed because I need to have a scalar value in that part of the foreach...but they're all arrays!  How am I supposed to do this, if it's even possible?</p>