Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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 scrutinizing the Monastery: (8)
As of 2017-10-21 20:46 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (270 votes). Check out past polls.