Folks,   
   This may be a naive query, but dashed if I know it.

   I have a large dataset, of financial data, and I need to check the
   results of some trading strategies on it. I have read the data into a
   hash of hashes of hashes, as I believe it's better than read this into
   an array (Or am I wrong here?)

   Here's the snippet of my code: 

open(IN,"<$DATAFILE") || die "Could not open $DATAFILE: $!";
   while(<IN>){
      chomp;
      ($nsecode,$date,$SASdate,$time,$midquote,$buy,$sell,
                $midqret,$curank,$curet) = split; 
      my($dt) = "${date}$time";
# Make a Hash of hashes of hashes.
      ${StockH}{$SASdate}{$nsecode}{midquote} = $midquote;
      ${StockH}{$SASdate}{$nsecode}{date} = $date;
      ${StockH}{$SASdate}{$nsecode}{buy} = $buy;
      ${StockH}{$SASdate}{$nsecode}{sell} = $sell;
      ${StockH}{$SASdate}{$nsecode}{midqret} = $midqret;
      ${StockH}{$SASdate}{$nsecode}{curank} = $curank;
      ${StockH}{$SASdate}{$nsecode}{curet} = $curet;
 }
close(IN);

   
   If I wanna see what I've read:

$VAR1 = '13265';
$VAR2 = {
          'TITAN' => {
                       'curet' => '-0.039766',
                       'curank' => '3',
                       'buy' => '120.90',
                       'midqret' => '0.000414',
                       'sell' => '120.60',
                       'date' => '26APR1996',
                       'midquote' => '120.75'
                     },
          'THOMASCOOK' => {
                            'curet' => '1.571835',
                            'curank' => '8',
                            'buy' => '690.00',
                            'midqret' => '0.012117',
                            'sell' => '680.00',
                            'date' => '26APR1996',
                            'midquote' => '685.00'
                          },
 snip snip snip                            
 snip snip snip                            


 But I would like to _save_ this data structure, in it's native form, in a
 file, so that Perl should just read the binary, the next time, so that I
 save on the reading time. How can I do this? I believe this is essential
 because it takes almost 13 seconds for the whole dataset to be read into
 the hash struct, which is unaffordable.  

 Any pointers? 

 TIA,
 -tir

-- 
Tirthankar, IGIDR. 
+91-22-2840 0919 x275 (r), x593(o), x542(CFL). 
http://www.igidr.ac.in/~tir

LOQUACITY, n.  A disorder which renders the sufferer unable to curb
  his tongue when you wish to talk.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to