Update:ysth just pointed out that your example data isn't two lines of 6 comma-separated single digits, but rather 2 x 3 comma-separated small floats.
That doesn't change the possibility of using packed array for you data, but it restrict the choices of available package that may be applicable. It could also double the storage requirement if you need the accuracy.
It also make using PDL perhaps the better choice depending on how you are going to manipulate the data. It carries the burden of being a pain to install, stupid notation, weird restrictions, huge learning curve and dog-aweful documentation--but it is both memory efficient and fast.
The most memory efficient method would be to used a tied array of packed integers or shorts. Each line of your file will require a single scalar, and each value 2 or 4 bytes depending upon the range of your values. As your original file is ascii encoded and contains lots of commas, the resultant memory structure might actually require less space that the file does on disk.
There are several packages on cpan for this: Packed::Array if you need the full 32-bit range for your values, or Tie::Array::packedC which appears to handle different size values, or Tie::IntegerArray and others.
In reply to Re: Array of Hashes vs. Array of Arrays vs Array of Lines vs ...
by BrowserUk
in thread Array of Hashes vs. Array of Arrays vs Array of Lines vs ...
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |