title: Perl and Foreach loop with Splitting
body: <p>I have a Problem about the Foreach Loop and Splitting with Perl.</p>
  
  <p>I want to loop the Arrays and split it to name and value.</p>
  
  <p>1.) I read the File and save to an String.</p>
  
  <p>2.) I split the empty line and save to an Array.</p>
  
  <p>My Script:</p>
  
  <pre><code>#!/usr/bin/perl
  
  use strict;
  
  my $pathconfigfile = 'config.conf';
  my @configline;
  
  open(my $configfile, "&lt;", $pathconfigfile);
  
  local $/;
  my @configdata  = split("\n\n",&lt;$configfile&gt;);
  
  #print $configdata[0], "\n";
  #print $configdata[1], "\n";
  #print $configdata[2], "\n";
  
  foreach my $data (@configdata){
          my @editing = split /#/, $data;
          my ($name, $value) = @editing[0,1];
          print $name "\n";
          print $value "\n";
  }
  
  close $configfile;
  </code></pre>
  
  <p><strong>Configfile:</strong></p>
  
  <pre><code>Testingtttttttttttttttttttttttt
  ############################################
  0987654345678909876MN09uz6t56789oiuhgölkjhgfr
  0987654323456789098765fgnloiuztlkjhgfrtzuiknb
  
  MegaMixoiuzt
  ############################################
  09876543457890098765NSUDlkjhzgtfr67899ztz9098
  098765435678987t87656789876567898765679097658
  
  TESTINGPARTS
  ############################################
  0987654567890098765hzzasza654567uhgdjdjfacdaa
  9876545678987654mchfuiaq754567898765434567876
  </code></pre>
  
  <p><strong>My wish result:</strong></p>
  
  <p>$name = Testingtttttttttttttttttttttttt</p>
  
  <p>$value = 0987654345678909876MN09uz6t56789oiuhgölkjhgfr
  0987654323456789098765fgnloiuztlkjhgfrtzuiknb</p>
  
  <p>$name = MegaMixoiuzt</p>
  
  <p>$value = 09876543457890098765NSUDlkjhzgtfr67899ztz9098
  098765435678987t8765678987656789876567909765</p>
  
  <p>$name = TESTINGPARTS</p>
  
  <p>$value = 0987654567890098765hzzasza654567uhgdjdjfacdaa
  9876545678987654mchfuiaq754567898765434567876</p>