o_chfa has asked for the wisdom of the Perl Monks concerning the following question:

my code is:

sub doSomething { ... use something; ... my $MessageText = <<Finis; ...we will have peace, when you and all your works have perished--and the works of your dark master to whom you would deliver us. You are a liar, Saruman, and a corrupter of men's hearts. --Theoden in /usr/src/perl/taint.c Finis ... } # sub doSomething

It writes out

 Can't find string terminator "Finis" anywhere before EOF at ./getSysDescr.pl line __LINE__

any ideas ?. Thx4hlp

( For the Textlines thx2 http://perldoc.perl.org/perlfaq4.html#Why-don%27t-my-%3C%3CHERE-documents-work%3F

Replies are listed 'Best First'.
Re: Here don't
by moritz (Cardinal) on Sep 07, 2009 at 06:27 UTC
    The terminator of the here-document has to be on a line of its own, with no leading whitespaces. So you need to put the Finis in the first column of the line.
    Perl 6 - links to (nearly) everything that is Perl 6.
Re: Here don't
by cdarke (Prior) on Sep 07, 2009 at 08:28 UTC
    From perlop:

    If you want your here-docs to be indented with the rest of the code, you'll need to remove leading whitespace from each line manually: ($quote = <<'FINIS') =~ s/^\s+//gm; The Road goes ever on and on, down from the door where it began. FINIS

Re: Here don't
by Anonymous Monk on Sep 07, 2009 at 06:42 UTC
    my $MessageText = <<' Finis'; ...we will have peace, when you and all your works have perished--and the works of your dark master to whom you would deliver us. You are a liar, Saruman, and a corrupter of men's hearts. --Theoden in /usr/src/perl/taint.c Finis die $MessageText; __END__ ...we will have peace, when you and all your works have perished--and the works of your dark master to whom you would deliver us. You are a liar, Saruman, and a corrupter of men's hearts. --Theoden in /usr/src/perl/taint.c