use threads;; open O, '>', 'junk.dat';; ## Open a file print O $_ for 1 .. 100; ## print some stuff to it print tell O;; ## print the file pointer position 392 async{ ## spawn a thread print tell O; ## inherits a (cloned) copy of the file handle 392 ## complete with pre-existing state print O $_ for 1 .. 100; ## print some more stuff from within the thread print tell O; ## And it's copy of the file handle reflects the change 784 };; print tell O;; ## but back in the main thread the original doesn't see it 392 print O $_ for 1 .. 100;; ## even after local modifications print tell O;; ## 784 close O; exit;; c:\test>wc -l junk.dat ## All the output ended up in the file, 300 junk.dat ## But neither threads file handle ## reflects the true pointer position.