title: Why does my Perl script die with an "out of memory" exception?
body: <p>I need to read a 200mb "space"-separated file line-by-line and collect its contents into an array. </p>
  
  <p>Every time I run the script, Perl throws an "out of memory" exception, but I don't understand why!</p>
  
  <p>Some advice please?</p>
  
  <pre><code>#!/usr/bin/perl -w
  use strict;
  use warnings;
  
  open my $fh, "&lt;", "../cnai_all.csd";
  my @parse = ();
  
  while (&lt;$fh&gt;) {
       my @words = split(/\s/,$_);
       push (@parse, \@words);
  }
  
  print scalar @parse;
  </code></pre>
  
  <p>the cnai file looks like this: it contains 11000 rows and 4200 values, seperated by "space", per line.</p>
  
  <pre><code>VALUE_GROUP_A VALUE_GROUP_B VALUE_GROUP_C 
  VALUE_GROUP_A VALUE_GROUP_B VALUE_GROUP_C 
  VALUE_GROUP_A VALUE_GROUP_B VALUE_GROUP_C 
  VALUE_GROUP_A VALUE_GROUP_B VALUE_GROUP_C 
  </code></pre>
  
  <p>The code above is just a stripped down sample.<br>The final script will store all values in a hash and write it to a database later . </p>
  
  <p><strong>But first, I have to solve that memory problem!</strong></p>