title: Perl script to get the first element of arrays passed as reference
body: <p>I want to call a subroutine by passing around 4 arrays to it and then get the first value of each array and then create a new array(array of first elements of arrays that are passed) in the subroutine and then return back that array. Here is the code I tried with</p>
  
  <pre><code>my @a = (97,34,6,7);
  my @b = ("A", "B", "F", "D");
  my @c = (5..15);
  my @d = (1..10);
  my @tailings = popmany ( \@a, \@b, \@c, \@d );
  
  print @tailings;
  
  sub popmany {
      my @retlist = ();
      for my $aref (@_) {            #1
          my $arrele = @$aref;       #2
          push @retlist , $arrele    #3
      }
      return @retlist;
  }
  </code></pre>
  
  <p>Here in  #1 I use a loop and get the first array , then in line 2 I assign the whole array to a variable, thinking that by default the perl will only store the first variable of array into @arrele.  the I push  the  $arrele to a new array  @retlist  , Sorry I dint refer any notes, so my procedure might be wrong. But this is throwing me a output like
      441110</p>
  
  <p>which has no sense. </p>
  
  <p>Please explain me the code how can I do that. </p>