title: Perl regex multi-line match into hash
body: <p>I'm successfully parsing a cisco config file, and grabbing the sections of config between each marker (cisco uses the ! symbol) using a multi line regex of:</p>
  
  <pre><code>/(search string)/i .. /^!/ 
  </code></pre>
  
  <p>My code looks like:</p>
  
  <pre><code>#!/usr/bin/perl -w
  use strict;
  use Data::Dumper;
  
  my (@results, @data) ;
  
  #Test data to simulate a while loop on a file-handle running through a config file.
  @data =  (
      "vlan 81" ,
      " name Vlan 81 test1" ,
      "!" ,
      "vlan 82" ,
      " name Vlan 82 test2" ,
      "!" ,
      "vlan 83" ,
      " name Vlan 83 test3" ,
      "!"
  );
  
  foreach ( @data ) {
      if ( /vlan/i .. /^!/ ) {
           push  (@results , $_) ;                
      }
  }
  
  print Dumper ( @results ) . "\n" ;
  
  exit;
  </code></pre>
  
  <p>It works really well, but I want to push the results into a hash, with each section of code being an anonymous array, so the results would look something like:</p>
  
  <pre><code>%Vlan -&gt; [Vlan 81, name Vlan 81 test1] , [Vlan 82, name Vlan 82 test2] , [Vlan 83, name Vlan 83 test3]
  </code></pre>
  
  <p>But I can't work out how to do it, my code matches per line between the search string and the marker and I just end up rebuilding the results into another array, line by line.</p>
  
  <p>Any help is much appreciated.</p>
  
  <p>Cheers,</p>
  
  <p>Andy</p>