Newsgroups: comp.lang.perl.misc
From: PerlFAQ Server <br...@stonehenge.com>
Date: Mon, 12 May 2008 18:03:02 -0700
Local: Mon, May 12 2008 9:03 pm
Subject: FAQ 4.38 Why don't my <<HERE documents work?
This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 4.38: Why don't my <<HERE documents work? Check for these three things: There must be no space after the << part. If you want to indent the text in the here document, you can do this: # all in one But the HERE_TARGET must still be flush against the margin. If you want ($quote = <<' FINIS') =~ s/^\s+//gm; A nice general-purpose fixer-upper function for indented here documents sub fix { This works with leading special strings, dynamically determined: $remember_the_main = fix<<' MAIN_INTERPRETER_LOOP'; Or with a fixed amount of leading whitespace, with remaining indentation $poem = fix<<EVER_ON_AND_ON; -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They If you'd like to help maintain the perlfaq, see the details in You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||