use Win32::API 0.40; Win32::API::Struct->typedef 'POINT', qw( LONG x LONG y ); Win32::API->Import( 'user32', 'BOOL GetCursorPos(LPPOINT lpPoint)' ); my $point = Win32::API::Struct->new('POINT'); my $retval = GetCursorPos($point); print "Cursor is at $point->{x}, $point->{y}\n";