Professional Web Applications Themes

printing block of text - PERL Beginners

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. Anyone got any ideas as to why it's doing this? Thanks. ************************************************** ********************** The information contained in this message or any of its attachments is confidential and is intended for the exclusive use of the addressee. The information may also be legally privileged. The views expressed may not be company ...

  1. #1

    Default printing block of text

    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.


    Anyone got any ideas as to why it's doing this?

    Thanks.
    ************************************************** **********************
    The information contained in this message or any of its
    attachments is confidential and is intended for the exclusive
    use of the addressee. The information may also be legally
    privileged. The views expressed may not be company policy,
    but the personal views of the originator. If you are not the
    addressee, any disclosure, reproduction, distribution or other
    dissemination or use of this communication is strictly prohibited.
    If you have received this message in error, please contact
    co.uk
    <mailto:co.uk> and then delete this message.

    Exide Technologies is an industrial and transportation battery
    producer and recycler with operations in 89 countries.
    Further information can be found at www.exide.com


    Ged Guest

  2. #2

    Default Re: printing block of text

    Ged Murphy wrote: 

    The here-doent syntax is described in "perldoc perlop", and the
    author of that part of the Perl docs had a couple of ideas.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Guest

  3. #3

    Default RE: printing block of text

    >> I'm trying to print a block of code using 'print <<LABEL; but am 
    >
    >The here-doent syntax is described in "perldoc perlop", and the
    >author of that part of the Perl docs had a couple of ideas.[/ref]

    I've been through the here-doentation in the perlop doc and it appears my
    syntax is correct.
    Does anyone have any ideas as to why I am getting this error?

    Is it possible this is an interpreter error?
    I'm running activestate's perl, v5.8.0 built for MSWin32-x86-multi-thread
    ************************************************** **********************
    The information contained in this message or any of its
    attachments is confidential and is intended for the exclusive
    use of the addressee. The information may also be legally
    privileged. The views expressed may not be company policy,
    but the personal views of the originator. If you are not the
    addressee, any disclosure, reproduction, distribution or other
    dissemination or use of this communication is strictly prohibited.
    If you have received this message in error, please contact
    co.uk
    <mailto:co.uk> and then delete this message.

    Exide Technologies is an industrial and transportation battery
    producer and recycler with operations in 89 countries.
    Further information can be found at www.exide.com


    Ged Guest

  4. #4

    Default Re: printing block of text

    On Thu, Sep 30, 2004 at 02:39:04PM +0100, Murphy, Ged (Bolton) wrote: 
    > >
    > >The here-doent syntax is described in "perldoc perlop", and the
    > >author of that part of the Perl docs had a couple of ideas.[/ref]
    >
    > I've been through the here-doentation in the perlop doc and it appears my
    > syntax is correct.
    > Does anyone have any ideas as to why I am getting this error?[/ref]

    Do you have a newline on line 3?
     

    But no carriage return or other white space?

    --
    Paul Johnson - net
    http://www.pjcj.net
    Paul Guest

  5. #5

    Default RE: printing block of text

    On Thu, 2004-09-30 at 15:39, Murphy, Ged (Bolton) wrote: 
    > >
    > >The here-doent syntax is described in "perldoc perlop", and the
    > >author of that part of the Perl docs had a couple of ideas.[/ref]
    >
    > I've been through the here-doentation in the perlop doc and it appears my
    > syntax is correct.
    > Does anyone have any ideas as to why I am getting this error?
    >
    > Is it possible this is an interpreter error?
    > I'm running activestate's perl, v5.8.0 built for MSWin32-x86-multi-thread[/ref]
    Hi,

    your code works fine for my debian box.
    --
    gabauxgabodeb:~/Stuff$ perl -v

    This is perl, v5.8.3 built for i386-linux-thread-multi
    --

    Gabaux

    Gabor Guest

  6. #6

    Default RE: printing block of text

    >Hi, 

    Must be the interpreter then. That is weird.
    This is being written for a Linux box so I'll just comment it out until
    then.

    Thanks.

    ************************************************** **********************
    The information contained in this message or any of its
    attachments is confidential and is intended for the exclusive
    use of the addressee. The information may also be legally
    privileged. The views expressed may not be company policy,
    but the personal views of the originator. If you are not the
    addressee, any disclosure, reproduction, distribution or other
    dissemination or use of this communication is strictly prohibited.
    If you have received this message in error, please contact
    co.uk
    <mailto:co.uk> and then delete this message.

    Exide Technologies is an industrial and transportation battery
    producer and recycler with operations in 89 countries.
    Further information can be found at www.exide.com


    Ged Guest

  7. #7

    Default RE: printing block of text

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

    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
    Chris Guest

  8. #8

    Default Re: printing block of text

    Murphy, Ged (Bolton) wrote: 

    perl is looking for a string terminator that looks like "\nTEST\n". Your
    editor may not be putting a newline at the end of the file. Try putting an
    extra one or two blank lines after the terminator.


    John
    --
    use Perl;
    program
    fulfillment
    John Guest

Similar Threads

  1. Block Printing .Net
    By Peter_Niepel@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 2
    Last Post: December 13th, 07:15 PM
  2. Vertically align text in a drawn text block
    By Paul_Urgero@adobeforums.com in forum Adobe Illustrator Windows
    Replies: 3
    Last Post: August 20th, 09:07 PM
  3. Missing text (flush right text block) upon export to pdf
    By Whirligig Man webforumsuser@macromedia.com in forum Macromedia Freehand
    Replies: 1
    Last Post: October 9th, 07:52 PM
  4. Printing a external text file or printing a text field cast member...
    By farhaad webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 1
    Last Post: July 18th, 02:31 AM
  5. Printing a externat text file or printing a text field cast member...
    By Doug Golenski in forum Macromedia Director Lingo
    Replies: 0
    Last Post: July 17th, 10:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139