I found this example at Win32::GuiTest::Examples called showmouse.pl. It didn't work at first until I either added $|++ or printed to STDERR.
#!/usr/bin/perl
# This script has been written by Jarek Jurasz jurasz@imb.uni-karlsruh
+e.de
#$|++; ## use this if you don't want to use STDERR
use Win32::GuiTest qw(GetCursorPos);
while (1)
{
my ($x, $y) = GetCursorPos();
print STDERR "\rx:$x y:$y -";
sleep 1;
}
|