On Tue, Aug 14, 2001 at 02:38:54PM -0400, Ron Woodall wrote:
>          Ok here's my original problem. I have 166 HTML tag pages that I'm 
> processing one at a time. Each tag page can have 197 attributes and 
> potentially more arguments. Once I process the tag section of the page, I 
> have to address the attributes and arguments. The problem is that any given 
> tag page can have none or 197 attributes or anywhere in between. I needed a 
> method whereby I could create variables "on the fly." What I ended up doing 
> was taking the attribute name and appending it to an array. I then use the 
> name to create a series of $attxxx{$attname} where "xxx" is a unique handle 
> for a specific value that may or may not exist for that attribute. The name 
> of the variable must come from the text on the page. Once I've gathered all 
> of the attribute names into an array, I sort the array and begin processing 
> the page. How can this be done while not using soft references?

Your question has been answered in this thread already: use a hash.  It can
be done, really.

Pull the variable portion out of the variable and use it as a key.  So
instead of $attxxx{$attname} use $att{xxx}{$attname}.

The thing with using soft references is that you're, effectively, using the
symbol table (the table of global variables and functions) as a hash.  This
has various points working against it that have been mentioned, including
polluting an area used by other parts of the program, and making it
difficult to track the variables you have in use.  Instead of using the
symbol table as a hash, use a hash as a hash; make a data structure that
solves your problem.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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

Reply via email to