Wiggins has asked for the wisdom of the Perl Monks concerning the following question:
my $tname = $properties->{'Name'} my %attributes = %{$properties->{'Attributes'}}; if ($tname eq "stix:Indicator") { }elsif($tname eq "cybox:Observable") { }elsif($tname eq "cybox:Title") { }elsif($tname eq "cybox:Description") { }elsif($tname eq "cybox:Title") { }elsif($tname eq "cybox:Object") { }elsif($tname eq "cybox:Properties") { }elsif($tname eq "URIObj:Value") {
Then I wondered, what about a hash keyed on the 'tname' and containing corresponding CODEREF?
More memory, more complex to set up, but possibility more efficient as the number of tags to be processed grows. What would be the tipping point for string compares?
Thoughts?
It is always better to have seen your target for yourself, rather than depend upon someone else's description.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: '100 elsif's vs hash of coderef's
by BrowserUk (Patriarch) on Dec 10, 2015 at 19:07 UTC | |
|
Re: '100 elsif's vs hash of coderef's
by dsheroh (Monsignor) on Dec 10, 2015 at 15:25 UTC | |
|
Re: '100 elsif's vs hash of coderef's
by GrandFather (Saint) on Dec 10, 2015 at 22:22 UTC | |
by AnomalousMonk (Archbishop) on Dec 10, 2015 at 23:03 UTC | |
by GrandFather (Saint) on Dec 10, 2015 at 23:52 UTC | |
by AnomalousMonk (Archbishop) on Dec 11, 2015 at 08:35 UTC | |
|
Re: '100 elsif's vs hash of coderef's
by Mr. Muskrat (Canon) on Dec 10, 2015 at 17:16 UTC | |
|
Re: '100 elsif's vs hash of coderef's
by ww (Archbishop) on Dec 10, 2015 at 16:57 UTC |