Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: no output or error received

by Athanasius (Chancellor)
on Jun 28, 2013 at 09:55 UTC ( #1041205=note: print w/replies, xml ) Need Help??

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,

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1041205]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2017-12-18 23:10 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (501 votes). Check out past polls.