At 9:40 PM -0800 3/27/97, Richard Pfeiffer wrote: >Strictly speaking, this is a Perl question, but I am asking it in a >Mac-oriented context, and it may be helpful to others on the list right >now, so I hope you'll bear with me :) > >... > >As you can see, I have to have a hard-coded reference variable name >($Style1, $Style2, etc.) for each new style sheet object, when what I'd >like to be able to do is refer to it indirectly by setting the value of a >scalar to the variable name, and then using that as a reference. I tried >setting up a scalar to contain the name of a style sheet, and then >referencing/dereferencing it, but I was told this wasn't allowed. > >Is there a way to do this in Perl? > I did do an identical project recently and found using multi-dimensional hashes worked pretty well. %ssdef{"Body_Text"}{SIZE} = 12; %ssdef{"Body_Text"}{FONT} = "Times"; and so on... This might be one of those cases where the tool debate comes up. You know that every problem has its own tool and not every tool applies to every problem. In this case, I am not sure what advantage using the OO paradigm would get you. From your description, you simply are wanting a table of values. I would not promote data to a "first class" object unless the data contained had to be transmorgified in some manner. Of course if you really want to do objects, I have found that when I have varying variable names that I must use, I simply put that part of the code into an eval statement. The drawback is the data created polutes the global namespace but sometimes you take the bad with the good. BTW (off the subject) Did you write the xtags parser yourself? What approach did you take? I did it by slurping the file into one long string then used about 2 dozen global search replace statemnts to seperate the tags. Then I used even more s//mg's to convert it to my final format. Ran into problems with the tags that contain quoted material though... Of course we had to go to pretty great lengths to "fix" text that had the wrong style sheet applied, e.g. text set in headline format which then they change the font, size, face to match what normally would be body text. Hope this helps, Fred --------------------------------------------------------------------------- | Fred Fenimore / | Box 14604 / | 3200 Chapel Hill-Nelson Hwy. / THIS SPACE AVAILABLE! | RTP, NC 27709-4604 / | voice : 919.558.8880x102 / | fax : 919.558.8889 / ---------------------------------------------------------------------------