Thank you. It is indeed in Windows. I tried it and it went well. But if I wanted to move my mouse and show its current position at the same time, how would you do it?
The code below seems to work for me, but it seems that the script is not fast enough to capture the mouse position.
while (1) {
my ($x, $y) = GetCursorPos();
print "X is at $x, Y is at $y\n";
}