Hello. I am trying to get print statements inside a function call inside a here-doc to work. Here is what I have so far:
#!/usr/bin/perl
use strict;
use warnings;
print <<"TEXT";
This
is
a
@{[ PrintHereDoc() ]}
here-doc.
TEXT
print "END\n";
# subroutine
sub PrintHereDoc
{
print "print statement inside a ";
return 0;
}
I want it to print:
This
is
a
print statement inside a
here-doc.
...but instead it is printing:
print statement inside a This
is
a
0
here-doc.
Why is the "print statement inside a" getting printed first? Also, is there a way I can disregard printing the return value of the subroutine?