On Wednesday, June 29, 2005 2:19 AM, $Bill Luebkert [SMTP:[EMAIL PROTECTED] 
wrote:
> Your explanation leaves a little to be desired.  You could knock it
> down to a single hash that contains pointers to all your arrays if
> that helps.  Then you could use names instead of numbers (or not).
> Not sure it's appropriate or not without seeing some access code.

Thank you for responding.  Sorry about the ambiguity.  The main program is a 
sequence of computational processes that reads several files of 20K to 50K 
records and splits them into 12 parallel arrays of that length.  Analytic 
routines generate an array (@trade) of 2K to 4K elements, each of which is a 
reference to an anonymous array of, say, 7 elements; built like so:

  for ($iS=1; $iS<=$#sigs; $iS++) {
    ...                                                 # processing...
    push(@trade,[$j,$i,"TaS",$sig,$amp,$elT,$tre[$j]]); # append trade to array
  }#for [0]begIx,[1]endIx,[2]indic,[3]type,[4]amplitude,[5]elapsedTime,[6]trend

Further on, other processes access this data for analysis, and to build and 
print other arrays, like so:

  for ($i=1;$i<=$#trade;$i++) {
    ...                                                 # processing...
    push (@tCycle,
      [$j,$l,$m,$trade[$i]->[2],$phWin,$trade[$i-2+$sSC]->[4],
        $trade[$i]->[5]+$trade[$i-1]->[5],[EMAIL PROTECTED]);
    ...                                                 # processing...
  }#for

A module was designed (TSP.pm), which contains two subroutines, one which 
prints descriptive statistics, and one which prints performance metrics for the 
@trade data.  The subroutines, in general, access individual elements of the 
anonymous arrays, like so:

  for ($i=0;$i<=$#{$rT};$i++) {
    ...                                                 # processing...
    $da = int(${$rD}[${$rT}[$i]->[0]]/86400)*86400;     # $rT is ref to @trade
    ...                                                 # processing...
  }#for

As mentioned previously, I got tired of editing the absolute indices (e.g., 
$trade[$i]->[6]) every time the order or meaning of an element of the anonymous 
arrays changed; so in main I defined typeglobs:

  *xbi = \0;    # index into data arrays, begin time
  *xei = \1;    # index into data arrays, end time
  *xi  = \2;    # indicator
  *xs  = \3;    # signal
  *xa  = \4;    # amplitude
  *xt  = \5;    # elapsed time
  *xr  = \6;    # trend

...to allow the use of variables for the indices, like so:

  push (@tCycle,
      [$j,$l,$m,$trade[$i]->[$xi],$phWin,$trade[$i-2+$sSC]->[$xa],
        $trade[$i]->[$xt]+$trade[$i-1]->[$xt],[EMAIL PROTECTED]);

My question is how best to get those typeglobs into the namespace of module 
TSP.pm so that, when I make a change, it's once in main, and the change is 
automatically propagated into TSP.pm.  Right now, I just cut and paste the 
typeglobs from main into TSP.pm.  Thank you.

-Neil
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to