Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: no output or error received

by Athanasius (Monsignor)
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,


Comment on Re: no output or error received
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1041205]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-08-30 19:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls