At 08:57 2005-06-29, L. Neil Johnson wrote:
Problem Statement:  The main program creates an array of pointers to

(Besides the point: there are no pointers in Perl. There are references though.)


anonymous arrays, each of which has about 10 elements.  Since I am in the
development phase, I keep changing the order and identity of the elements.

So maybe if the order isn't important you could use a hash instead and use meaningful names (strings) as keys?


 Because there are many lines of code that reference those elements, I
abandoned numeric offsets (indices) and went to variable offsets (actually
I use typeglob refs to constants to catch instances where I might
accidentally try to change one).  I also coded a module with subroutines

This also sounds more like a hash.


Question: What's the best way to handle this situation?

If you're familiar with OO, that sounds like the way to go. You have data. You have subs that act on this data. That's a class right there.


Can I export those
offsets from main:: and "use" them in the module? Or is there some pragma
that can be used to generate compile-time constants with global visibility?
 Any suggestion would be appreciated.

Create a new module for the constants.

perldoc Exporter or
http://search.cpan.org/~nwclark/perl-5.8.7/lib/Exporter.pm
http://search.cpan.org/~nwclark/perl-5.8.7/lib/Exporter.pm#How_to_Export
http://search.cpan.org/~nwclark/perl-5.8.7/lib/Exporter.pm#How_to_Import


/J

-------- ------ ---- --- -- --  --  -     -     -        -          -
Johan Lindström    Sourcerer @ Boss Casinos   johanl AT DarSerMan.com

Latest bookmark: "TCP Connection Passing"
http://tcpcp.sourceforge.net/
dmoz: /Computers/Programming/Languages/JavaScript/ 12

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

Reply via email to