warrior32
asked on
How to print html
How would I print out embedded html in perl. For example this works
print <<EOF;
<html>
<head>
<title>My HTML page</title>
</head>
<body>
<br>
First Message to print out
<br>
Second message to print out
<br>
Third message to print
</body>
</html>
EOF
however I want to add an if statement to determine which message to print out. I tried the following with no luck
print <<EOF;
<html>
<head>
<title>My HTML page</title>
</head>
<body>
<br>
EOF
if($test == 0){
print <<EOF;
First Message to print out
<br>
EOF
}
else{
print <<HTML;
Second message to print out
<br>
HTML
}
print <<HTML;
</body>
</html>
HTML
print <<EOF;
<html>
<head>
<title>My HTML page</title>
</head>
<body>
<br>
First Message to print out
<br>
Second message to print out
<br>
Third message to print
</body>
</html>
EOF
however I want to add an if statement to determine which message to print out. I tried the following with no luck
print <<EOF;
<html>
<head>
<title>My HTML page</title>
</head>
<body>
<br>
EOF
if($test == 0){
print <<EOF;
First Message to print out
<br>
EOF
}
else{
print <<HTML;
Second message to print out
<br>
HTML
}
print <<HTML;
</body>
</html>
HTML
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There are other ways to do it, but what was unlucky about what you tried?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.