|Perl: the Markov chain saw|
Re: Is there a difference in this declaration?by kcott (Chancellor)
|on May 09, 2014 at 08:37 UTC||Need Help??|
There's no difference. Both declare a hash with zero key/value pairs:
Including an assignment has some overhead: typically negligible but may be significant in looping code.
I wouldn't necessarily consider one form to be "more correct" than the other.
I generally use the "my %hash_data;" form.
[Minor Update: I removed "use autodie;" from the benchmark code as it wasn't necessary (it was an artefact from the last use of this script which I often rework for example code); retested; much the same results.]