From: "Octavian Rasnita" <[EMAIL PROTECTED]>
> Which would be the best method for creating a better program,
> accessing the content of a hash or a dereference like $hash{key},
> $ref->{key} in many places in the script, or using:
>
> my $value = $hash{key}, ... my $value = $ref->{key} then using $value
> for many times in the rest of the script?
>
> Would be the second way faster, or it won't make any difference?
Premature optimization is the root of all evil.
That said, yes lexical scalar access is quicker than hash access, but
the difference is so tiny that it usualy doesn't matter, except maybe
in a terribly tight loop. Readability and maintainability is much
more important.
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>