svsingh has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Printing Scalars Next to Text
by bart (Canon) on May 03, 2003 at 08:44 UTC | |
|
(joshua) Re: Printing Scalars Next to Text
by joshua (Pilgrim) on May 03, 2003 at 05:55 UTC | |
|
Re: Printing Scalars Next to Text
by jonadab (Parson) on May 03, 2003 at 13:51 UTC | |
|
Re: Printing Scalars Next to Text
by jgallagher (Pilgrim) on May 03, 2003 at 05:52 UTC | |
by svsingh (Priest) on May 03, 2003 at 06:19 UTC | |
by jgallagher (Pilgrim) on May 03, 2003 at 06:52 UTC | |
|
Re: Printing Scalars Next to Text
by pfaut (Priest) on May 03, 2003 at 12:05 UTC | |
|
Re: Printing Scalars Next to Text
by Anonymous Monk on May 03, 2003 at 14:27 UTC | |
|
Re: Printing Scalars Next to Text
by LordWeber (Monk) on May 03, 2003 at 09:45 UTC |