perlquestion
Anonymous Monk
I was reading in <a href="http://www.bookpool.com/ss?qs=effective+perl+pro&x=0&y=0">Effective Perl Programming</a> about creating hash references such as this:
<code>$student = {};
$student->{last} = 'Smith'; </code>
I believe he is saying that this is more efficient to be passed to a subroutine, and I agree with that.
<br>What puzzles me though is that you can, and should, always pass a reference to a hash, or array, to a subroutine anyway:
<code>
&sub(\%hash, \@array);
</code>
I have also heard that it is faster to create and use a hash reference <u>in general</u> than using a "regular" hash such as:
<code>my %student = {};
$student{'last'} = 'Smith';
</code>
This might be a silly question but is it more efficient to declare and uses hashes that way (reference) and if it is more efficient then why do we have the possibility to declare and use them the "regular" way?
<br>Is it one of those TIMTOWTDI things?
<p>Confused Monk</p>
21