Paul Tremblay wrote: > Thanks, but this won't work. I need to open the data file and read > some data. Later in the script, I need to open the data file again > and read more data. When I use <DATA>, perl apparently reads one > line at a time until it finds what I want. It then starts at the line > I left off when I need to read more data. It does not start at the > beginning again, so I cannot find the data I need. > > The only solution I can think using the __DATA__ method would be to > have my script print out *all* data to a temporary file. I could then > open and close this file when I wanted data. But this seems like kind > of a hack--and it would take a bit more time, though only a second or > two.
Two alternate approaches: 1) read the data into a memory structure (array or hash) 2) use tell()/seek() on the DATA file handle to move around. n.b. seek(DATA, 0, SEEK_SET) does not put you at the first line after __DATA__, it puts you at the top of your script file. So use tell() to mark the start point before you start reading. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]