I looked again at your question and it looks to me like the problem is more a misuse of the "heredoc" rather than an open() question. A "heredoc" is often used say for a long bunch of text that you want to perhaps print or use in some other way. It is just a shorthand way of making a single string out of multi-line text.
print <<END; This is some long winded window text that could appear somewhere and using this heredoc allows me to type it in without having to double quote it or put in "." concatenations or "\\n" characters as this will be printed verbatim just like it is except note that I had to double escape the newline! Otherwise it would be a "newline"! END
So a "heredoc" just makes a string! There is no "open" involved, it is just a string like any other string. If you want to iterate over a number of constant values in your program, there are other ways:
1. Use @stuff like this: @stuff = qw (thing1 thing2 thing3);foreach (@stuff){..blah..}
2. For some test data, use a __DATA__ segment placed after your executable code. The DATA file handle doesn't need to opened or closed - you can just read from it.
I'm saying that putting a list of file names inside of a "heredoc" is a rather weird looking thing to do.
while (<DATA>) { chomp; #just to show you what the \n is there #just like from a file.. print "$_\n"; } __DATA__ thing1 thing2 thing3
There are a number of variations on open() which I think have been covered quite well below. I didn't know before that $somevar could be opened as a a RAM file (a memory resident temp file) in Perl 5.8. I've always just generated a "real" temp file in the past.

You cannot write to a "heredoc", nor to the DATA filehandle.


In reply to Re: Open Function Question by Marshall
in thread Open Function Question by bichonfrise74

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.