in reply to Re: Re: Hashes/Scalars and Memory Usage
in thread Hashes/Scalars and Memory Usage
If your code varies in more than this respect (e.g. size, the use of another hash key besides CompanyInfo, etc), you could re-structure the @FIELDS array something like this:my @FIELDS = ( company_name => 'Company Name', company_addr => 'Company Address', ... ); for (my $i = 0; $i < @FIELDS; $i+=2) { my $field = $cgi->textfield( -name => $FIELDS[$i], -default => $tabdata->{CompanyInfo}->{$FIELDS[$i]}, -size => 30, ); $screen->AppendToSection('body', <<"EOF"); <tr> <td class='fieldname'>$FIELDS[$i+1]</td> <td class='fieldvalue'>$field</td> </tr> EOF }
Then adapt your code to follow suit..my @ARRAY = ( 'Company Name' => [ 'CompanyInfo' => 'company_name', 30 ], 'Company Address' => [ 'CompanyInfo' => 'company_addr', 60 ], ... );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Hashes/Scalars and Memory Usage
by EvilTypeGuy (Initiate) on Feb 10, 2001 at 02:14 UTC |