Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: output caught in memory

by Wookie (Beadle)
on Jul 26, 2001 at 20:33 UTC ( [id://100040]=note: print w/replies, xml ) Need Help??


in reply to output caught in memory

The easiest way to make sure the write occurs is to write it in two lines - and set your write buffers to instant write.

So try this:
$|=1; # $| is undef by default - which means use buffering - define it + as 1 - and it instantly writes. print FILE scalar localtime; print FILE " ## Exit\n"; close FILE;
Alternatively, you can try to build the entire entry into a variable first - then write it. So:
$close = localtime; print FILE "$close ## Exit\n"; close FILE;
I hope this helps :).

Update: Remove quotes around scalar localtime in first code block (thanks MZSanford)
game(Wookie,opponent) eq 'Wookie' ? undef $problem : remove_limbs(arms,opponent);

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2025-03-18 03:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (56 votes). Check out past polls.