Quoting "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>:

>Also, some of
> the possibilities--six, in fact--contain multiple lines of code. I don't
> know enough Perl yet to handle these cases.
> 
> As a final obstacle, the HoH or AoH or whatever-of-whichever--the hash 
> that "reads" the others--proposed would have to be declared inside the 
> sub, after the variables $row and $val get their passed-in values. 

I haven't tried this but I "think" that you could do what you're trying to do 
by setting up your common subroutines as subs outside the translate sub. Then 
create a hash of references to the subroutines (or if you take it further a 
hash of anonymous subroutines - but that's darker magic and harder to follow). 
Then in your translate, you can reference the hashvalue to get the subroutine 
that is required and have the sub evaluated at run time rather than as the 
hash is created.



====PSEUDO-PERL-BEGINS=====


sub One {
  my ($oldvalue)[EMAIL PROTECTED];
  #do stuff
  return $new_value;
}

sub Two {
  my ($oldvalue)[EMAIL PROTECTED];
  #do stuff
  return $new_value;
}

my %Actions = ( 1 => \One,
                2 => \Two,
                3 => \Two,
                ...
                61=> \Three
               );


sub translate {
  my ($var2,$var2) = @_;
  return &{$Actions{$var1}}($var2);
}

====PSEUDO-PERL-ENDS=====

I think, it would look somehting like that. It's easier to describe it in code 
than english.  The syntax if undoubtedly wrong, but I think it's a step in the 
right direction. Look up references to subroutines for the precise syntax.

Steve


_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to