in reply to Re^2: locking STDOUT
in thread locking STDOUT

i havent been clear enough in what i want to do actually, i have a multithreding app and i want to print stuff on the screen just as they happen. i want print to be atomic so thats why i want to lock the screen before i start doing anything. id like to get the order in wich threads

In that case, I don't think you want to lock the screen but set STDOUT to be non-buffering. See the $| entry in perlvar or Suffering from Buffering.

-derby

Update: At the beginning of your script, I would set STDOUT to be non-buffering:

select STDOUT; $| = 1;