5 ms·
Does anyone know if there's any similar ability in Perl 5?
by cmhamill 13y ago
Does anyone know if there's any similar ability in Perl 5?
- xb95 13y agoYup. It's called 'fields': http://perldoc.perl.org/fields.html http://perldoc.perl.org/fields.html I echo what they said in that post, though: don't prematurely optimize. If you find you have tons of objects and need the RAM or you're actually paying a premium for hash accesses, then fields can save you some effort... but if you've a small use case, don't bother.
- berntb 13y agoPerl is better at sharing memory for hash keys by default, this particular problem might not show up enough for your use cases.