Ok. Let's get back to basics then :)
When you look things up in a hash, you use a string as the index. So your first example is the same as:
$index = 'connection1_size1';
$$hashRecordPtr{$index};
Do you follow that? The hash index is just any string value.
But what we've done there is to now use a variable as the hash index. Which means that we can now be a bit cleverer.
$index = "connection1_size$count";
$$hashRecordPtr{$index};
So now we have a double-quoted string, and we've used the value of the variable $count within the string.
So that effectively does what you want, but we can cut out the unnecessary $index variable and use the double-quoted string directly as the hash index.
$$hashRecordPtr{"connection1_size$count"};
Is that any clearer?
--
< http://dave.org.uk>
"The first rule of Perl club is you do not talk about
Perl club." -- Chip Salzenberg
|