in reply to Help needed with file output and hashes.

You don't need to open the DATA handle.

Your main problem is that you reopen $file to truncate and write with '>'. Open to append with '>>' and your previous writings will survive. You should probably just open once and leave the file open until you're finished.

After Compline,
Zaxo

  • Comment on Re: Help needed with file output and hashes.

Replies are listed 'Best First'.
Re^2: Help needed with file output and hashes.
by Fletch (Bishop) on Oct 31, 2005 at 19:13 UTC
    You don't need to open the DATA handle.

    Well, more to the point the filehandle DATA is special to perl (reading from it will give you what comes after the __END__ token in your source). It doesn't look like that's what you're doing so you might be better served (more to the point, the person who comes in down the road and tries to make sense of your code might be better served) using a different name for this handle (e.g. INFILE or DATAFILE).