autosave everytime loops runs

S

Shan

ok so I have the following:

open my $OUT, '>', 'write.tsv' or die "Error: $!";

write.tsv is the file I want my results printed to.

I want the file to be saved everytime a loop runs so that if the
program crashes I still have the information that was processed.

So i guess I need a save statement inside the loop but i Dont know of
any statements, do yoo?

Thanks in advance
 
B

Ben Morrow

Quoth Jim Gibson said:
Perl doesn't have a "save" statement. I believe what you are saying is
that you want to write your data out to the file every time the loop
runs. So do so.

You may also want to see the methods 'flush' and 'sync' in IO::Handle
(hint: you want to use both of them, in that order :) ), or the special
var $|.
The Perl statements to write to a file are print and printf (and in
more complex or binary applications, write and syswrite.

More complex, maybe. print and printf both handle binary data just fine.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,265
Messages
2,571,069
Members
48,771
Latest member
ElysaD

Latest Threads

Top