I'm very new to Perl/CGI unfortuantely and have done C++ for some years so am probably trying to mix the two badly :)
I am trying to achieve the following :
if($submit eq "Preview")
{
$outputType="<<EOF";
output($outputType);
}
sub output {
($outputType, $outputTypeShort) = @_;
print"content-type: text/html\n\n";
print $outputType;
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Special Offer</title>
<link rel="stylesheet" type="text/css" href="specials.css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
EOF
}
I'm not sure if I'm passing the variable correctly etc, but what I am trying to achieve is to call a 'Function' Ouput which either prints to screen, prints to file, or does both. I was aiming to do this with 1 output function which took a parameter which either stored "<<EOF" or "OUT<<EOF" so that when I called print $outputType; it would print to the correct place. I presume I'm either doing something wrong or what I'm trying to do is completely impossible. I get the impression that its ok to call the variable to be printed out, e.g. print "$outputType"; but its not possible to do print $outputType; ....OUPUT_HERE.... EOF
I appreciate any help,
Thanks,
Stuart.
me@stu.uk.com
I am trying to achieve the following :
if($submit eq "Preview")
{
$outputType="<<EOF";
output($outputType);
}
sub output {
($outputType, $outputTypeShort) = @_;
print"content-type: text/html\n\n";
print $outputType;
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Special Offer</title>
<link rel="stylesheet" type="text/css" href="specials.css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
EOF
}
I'm not sure if I'm passing the variable correctly etc, but what I am trying to achieve is to call a 'Function' Ouput which either prints to screen, prints to file, or does both. I was aiming to do this with 1 output function which took a parameter which either stored "<<EOF" or "OUT<<EOF" so that when I called print $outputType; it would print to the correct place. I presume I'm either doing something wrong or what I'm trying to do is completely impossible. I get the impression that its ok to call the variable to be printed out, e.g. print "$outputType"; but its not possible to do print $outputType; ....OUPUT_HERE.... EOF
I appreciate any help,
Thanks,
Stuart.
me@stu.uk.com