in reply to Curly braces variable
As toolic points out, the braces are usually employed when accessing a variable and are necessary when you have to interpolate a variable into a string and the variable name has to be disambiguated from following text. An alternative is to use concatenation. In the following code the braces are needed because there is no $preffish variable.
knoppix@Microknoppix:~$ perl -E ' > @prefs = qw{ cat dog monk }; > foreach $pref ( @prefs ) > { > say qq{${pref}fish}; > say $pref . q{fish}; > }' catfish catfish dogfish dogfish monkfish monkfish knoppix@Microknoppix:~$
I hope this is helpful.
Cheers,
JohnGG
|
|---|