http://www.perlmonks.org?node_id=1041205


in reply to no output or error received

Hello rocketperl,

You are opening the filehandle OFILE for writing on each loop iteration. That truncates the file every time! You need to open OFILE once only, before the while loop starts, and then print to it as marto has shown.

Update: As ww points out, it might be clearer to say that when you (re-)open an existing file for writing, you will then be overwriting whatever was there before. Although open uses the term “truncate” in this context, this should not be confused with Perl’s truncate function which reduces a file to a given length.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,