in reply to Re^4: Interpolation in a hash key
in thread Interpolation in a hash key
... and of course, there are some times when we need to help the interpreter know when our variable begins and ends. In the example davorg gave you, $count fell at the end of your hash key (index). But suppose you wanted the $count to fall in the middle of your key, like this:
$index = "connection$countsize";
How would the interpreter know that you were referring to $count? You might have also been referring to $counts, $countsi, $countsiz, or $countsize. In such cases, you would put curly braces around the variable name to delimit it from the rest of the text.
$index = "connection${count}size";
|
|---|