title: Conditional regex capture, from grepping array of hashes
body: <p>Given the following anonymous array of hashes:</p>
  
  <pre><code>$fields_dump = [
      {
          'DEFAULT_FIELD_LABEL' =&gt; 'telco_hier_building',
          'APPROVER_ORDER' =&gt; '0',
          'IS_READONLY' =&gt; '0',
          'FORM_ID' =&gt; '3913',
          'REFERENCE' =&gt; 'building',
      },
      {
          'DEFAULT_FIELD_LABEL' =&gt; 'Request Type',
          'APPROVER_ORDER' =&gt; '0',
          'IS_READONLY' =&gt; '0',
          'FORM_ID' =&gt; '3913',
          'REFERENCE' =&gt; 'request_type',
  
      },
      {
          'DEFAULT_FIELD_LABEL' =&gt; 'Request Completion Date',
          'APPROVER_ORDER' =&gt; '0',
          'IS_READONLY' =&gt; '0',
          'FORM_ID' =&gt; '3913',
          'REFERENCE' =&gt; 'request_completion_date',
      },
  </code></pre>
  
  <p>I want to conditionally grep the array by <code>DEFAULT_FIELD_LABEL</code> for the value of either <code>telco_hier_building</code> or <code>telco_imac_building</code>. When it succeeds I need to extract up to the second underscore of the value that was matched.</p>
  
  <p>I am using the following code:</p>
  
  <pre><code>if  ( grep { $_-&gt;{DEFAULT_FIELD_LABEL} =~ m/(telco_hier_|telco_imac_)building/ } @$fields_dump ) {
      my $telco_prefix = $1;
      ...
  }
  </code></pre>
  
  <p>The conditional triggers properly, but regex <code>$1</code> assignment is blank, when in this example case, it should be <code>telco_hier_</code>. </p>
  
  <p>What am I doing wrong?</p>