package mymod; use warnings; use Win32::API; #### define the structure Win32::API::Struct->typedef( POINT => qw{ LONG x; LONG y; }); #### import an API that uses this structure Win32::API->Import('user32', 'BOOL GetCursorPos(LPPOINT lpPoint)'); #### create a 'POINT' object my $pt = Win32::API::Struct->new('POINT'); #### call the function passing our structure object GetCursorPos($pt); #### and now, access its members print "The cursor is at: $pt->{x}, $pt->{y}\n"; 1;