You forgot the line:
use Fcntl;
Easy mistake to make. That should fix it.
Update:
I tried your code (plus the use statement and a few print statements) on my NT box with Perl 5.6 and got this rather annoying message:
Your vendor has not defined Fcntl macro F_GETFL, used at C:\temp.pl li
+ne 10.
That means the Fcntl implementation in my install is incomplete. I suspect this is going to be true across Windows installations, so you might want to write a wrapper around Fcntl that defaults to Fcntl but fills in the holes when they are missing.