in reply to sort using <=>
Are you wondering why the second loop (the foreach) isn't doing anything? It's because you only come out of the while loop above it after reading everything out of the D filehandle, so the foreach over the same handle will never enter the block.
I'm not sure exactly what you're trying to do, so I'm not sure how to tell you to fix it. But that's the reason you're not getting anything written to FOO.
|
|---|