title: Perl multidimensional array search
body: <p>i'm new to perl, and excuse me if my question confuses.</p>
  
  <p>i have a multidimensional array which has 4 columns and many rows.</p>
  
  <p>need to search if first element of each row is matches with a variable. </p>
  
  <p>if matches , concatenate another variable in the 3rd column.
  if NO match, push to the same array.</p>
  
  <p>example :</p>
  
  <p>getting 4 different variables from other loops/logic.</p>
  
  <p><code>$var1</code>, <code>$var2</code>, <code>$var3</code>, <code>$var3</code></p>
  
  <p>and pushing them to a temp array. </p>
  
  <pre><code>push @local,$var1,$var2,$var3,$var4;
  </code></pre>
  
  <p>before pushing them main array i need to check, if var1 already exists in the column1 of  <code>@new array</code>. if exists, concatenate the third column of the same row.</p>
  
  <p>if var1 not exists in column1 of <code>@new array</code>,  then push <code>@local2</code> to <code>@new</code>.</p>
  
  <p>if anyone knows how I do this, please post how and it will be greatly appreciated.</p>
  
  <p>thanks :)</p>