On Thu, 30 Sep 2004, Murphy,  Ged (Bolton) wrote:

> I'm trying to print a block of code using 'print <<LABEL; but am
> getting an error stating perl can't find the termination label.
> Test code and error as follows:
> 
> #!/usr/bin/perl
> 
> print <<TEST;
> this is my tester text
> TEST
> 
> Can't find string terminator "TEST" anywhere before EOF at photo.pl
> line 3.

Weird bugs like this were what made me stop using heredocs in most 
cases. I find multi-line q{} blocks much more readable:

    #!/usr/bin/perl

    print qq[
    this is my first tester text, with "double-quotes"
    ];

    print q{
    this is my second tester text [with 'single-quotes']
    };

This way, most text editors tend to be able to pick up the string 
terminating characters () [] {} and help make sure that things remain 
balanced. I've had better luck this way than I ever did with heredocs.


-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to