in reply to Re: Should we bother to save hash lookups for performance? (yes, sometimes)
in thread Should we bother to save hash lookups for performance?
This becomes especially useful when there exists and you need to access several things at a given level.
my $port = $self->{center}{floor}{room}{bay}{rack}{unit}{port}; unless ( --$port->{timecount} ) { unless ( $port->{transmitted} or $port->{received} ) { close( $port->{handle} ); } else { $port->{timecount} = $port->{timeout}; $port->{transmitted} = $port->{recieved} = 0; } }
This neatly emulates the Pascal-style with ... statement.
I guess you could even use my $with_port = ... but that would be altogether to cute (and extra to type:^).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Should we bother to save hash lookups for performance? (yes, sometimes)
by Aristotle (Chancellor) on Oct 19, 2002 at 20:29 UTC | |
by BrowserUk (Patriarch) on Oct 19, 2002 at 20:59 UTC | |
by Aristotle (Chancellor) on Oct 19, 2002 at 21:05 UTC |