in reply to how to put perl variables inside html tags
Are you using CGI for this?
Is it in a 'here doc'?
Are you using a print statement for each line?
The value $afld[3] can be printed or interpolated just fine. The only thing to be careful of is how to incorporate the double-quotes in your html and still interpolate the array value.
The problem of course is that if you want to interpolate the value in a string, the string has to be specified in a double-quotish manner. But if you just enclose it in double-quotes, the html double-quotes mess things up. There are a variety of approaches:
...to give just two examples.print qq[<a href="mailto:$afld[3]">]; or print '<a href="mailto:' . $afld[3] . '">';
Note also: there is nothing between <a href="mailto:$afld[3]"> and the </a> tag. If this is an accurate snippet, the mailto: link is there but no link text is being displayed because you have specified nothing.
Update: If you have a managable number of these values to interpolate, this approach works fine. If you are doing more ambitious things with lots of interpolated values and other fancy programmatic stuff, check into the embedding/templating solutions that have been proposed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: how to put perl variables inside html tags
by Anonymous Monk on Jul 28, 2001 at 03:21 UTC | |
by dvergin (Monsignor) on Jul 28, 2001 at 03:57 UTC |