Gossamer Forum
Home : General : Perl Programming :

Possible to do print $outputType; where $outputType="<<EOF"

Quote Reply
Possible to do print $outputType; where $outputType="<<EOF"
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
Subject Author Views Date
Thread; hot thread Possible to do print $outputType; where $outputType="<<EOF" -=Stu=- 18706 May 8, 2002, 4:08 AM
Thread; hot thread Re: [-=Stu=-] Possible to do print $outputType; where $outputType="<<EOF"
Andy 18334 May 8, 2002, 4:23 AM
Post; hot thread Re: [Andy.] Possible to do print $outputType; where $outputType="<<EOF"
-=Stu=- 18237 May 8, 2002, 4:32 AM
Thread; hot thread Re: [Andy.] Possible to do print $outputType; where $outputType="<<EOF"
Paul 18406 May 8, 2002, 4:36 AM
Thread; hot thread Re: [Paul] Possible to do print $outputType; where $outputType="<<EOF"
Wil 18264 May 8, 2002, 5:23 AM
Thread; hot thread Re: [Wil] Possible to do print $outputType; where $outputType="<<EOF"
Paul 18244 May 8, 2002, 5:29 AM
Thread; hot thread Re: [Paul] Possible to do print $outputType; where $outputType="<<EOF"
Andy 18233 May 8, 2002, 5:34 AM
Thread; hot thread Re: [Andy.] Possible to do print $outputType; where $outputType="<<EOF"
Paul 18313 May 8, 2002, 5:38 AM
Thread; hot thread Re: [Paul] Possible to do print $outputType; where $outputType="<<EOF"
Wil 18152 May 10, 2002, 1:45 AM
Thread; hot thread Re: [Wil] Possible to do print $outputType; where $outputType="<<EOF"
Paul 18279 May 10, 2002, 1:53 AM
Post; hot thread Re: [Paul] Possible to do print $outputType; where $outputType="<<EOF"
Wil 18099 May 10, 2002, 1:59 AM
Thread; hot thread Re: [Andy.] Possible to do print $outputType; where $outputType="<<EOF"
Wil 18410 May 8, 2002, 5:42 AM
Thread; hot thread Re: [Wil] Possible to do print $outputType; where $outputType="<<EOF"
Andy 18311 May 8, 2002, 5:54 AM
Thread; hot thread Re: [Andy.] Possible to do print $outputType; where $outputType="<<EOF"
Wil 18441 May 8, 2002, 5:58 AM
Thread; hot thread Re: [Wil] Possible to do print $outputType; where $outputType="<<EOF"
Andy 18180 May 8, 2002, 6:03 AM
Thread; hot thread Post deleted by Wil
Wil 18323 May 8, 2002, 6:07 AM
Thread; hot thread Re: [Wil] Possible to do print $outputType; where $outputType="<<EOF"
-=Stu=- 18162 May 8, 2002, 6:21 AM
Thread; hot thread Re: [-=Stu=-] Possible to do print $outputType; where $outputType="<<EOF"
Paul 18317 May 8, 2002, 6:41 AM
Thread; hot thread Re: [Paul] Possible to do print $outputType; where $outputType="<<EOF"
-=Stu=- 18212 May 8, 2002, 7:26 AM
Post; hot thread Re: [-=Stu=-] Possible to do print $outputType; where $outputType="<<EOF"
Paul 18196 May 8, 2002, 7:55 AM
Thread; hot thread Re: [-=Stu=-] Possible to do print $outputType; where $outputType="<<EOF"
Paul 18306 May 8, 2002, 4:41 AM
Post; hot thread Re: [Paul] Possible to do print $outputType; where $outputType="<<EOF"
-=Stu=- 18183 May 8, 2002, 4:50 AM