I'm trying to create some HTML with Perl. The print stament has a variable immediately before some text and I read that in these cases, you should surround the variable name with brackets. Here's the code I'm using:
my $link = "<a href=\"" . &getQueryString('title') . "\">"; print "<th>${link}Title</a></th>\n";
No matter how I think about this, I can't see how using "<th>$linkTitle</a> would be good. However, when I run this using strict and with the -w option, Perl spits out the following warning:
Ambiguous use of ${link} resolved to $link at movies.pl line 165.
I wish I could find where I read I could surround variables with brackets, but I can't. Is this valid? If so, then what's it called. Searching the web for "${" isn't proving too fruitful.
Note: After previewing the message it seems odd that I'm even splitting this into two lines. I repeat these lines with some slight modifications a few times and keeping everything in two lines keeps the code readable for me.
Thank you.
In reply to Printing Scalars Next to Text by svsingh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |