Re: Here document as method parameter



Ender wrote:
Is there any way to pass here document string as method parameter?

Suppose we have a demo object:

#########################
package Demo;

sub new {
bless {};
}

sub output {
my $self = shift;
print STDOUT shift;
}


2).
#########################
my $demo = Demo->new();
$demo->output <<'EOF';
main()
{
printf("hello world\n");
}
EOF
#########################
Perl will complain for syntax error, but it looks more conventional for
me.

Very close. You just forgot the parentheses.

$demo->output(<<'EOF');

Paul Lalli

.