Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Here doc w/variable 1

Status
Not open for further replies.

gnubie

Programmer
Joined
Apr 16, 2002
Messages
103
Location
US
In a here doc, is there a way to concatenate a variable directly with the text? For example, to execute 'myscript.pl' below.

Code:
  if ($secure) {
    $path = "[URL unfurl="true"]https://www.secure.com/cgi-bin/";[/URL]
  } else {
    $path = "[URL unfurl="true"]http://www.abc.com/cgi-bin/";[/URL]
  }

  print <<EOT;
  <form action=&quot;$pathmyscript&quot;>
  </form>
EOT

I know I could break it out and create the whole variable before the here doc, but I would like to know if there is a method of terminating the variable within the here doc.

Thanks,

G. Nubie
 
Enclose the variable name in braces as in:

print <<EOT;
<form action=&quot;${path}myscript&quot;>
</form>
EOT

 
That did it. Thanks.

G
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top