# Old Skool calls use Win32::API; my $getwindir = new Win32::API(kernel32 => GetWindowsDirectoryA => [qw(P N)], "N") or die "Can't locate function: $!"; # ... or use 'PN' for the 3rd parameter, if Win32::API is recent enough (version?) my $buffer = "\0" x 300; my $length = $getwindir->Call($buffer, length $buffer); print substr $buffer, 0, $length; #### # New Skool calls ($Win32::API::VERSION >= 0.40) use Win32::API; my $getwindir = new Win32::API(kernel32 => 'LONG GetWindowsDirectoryA( LPSTR buffer, LONG maxlength )') or die "Can't locate function: $!"; # Do this, or bear the consequences: delete $getwindir->{proto}; my $buffer = "\0" x 200; my $length = $getwindir->Call($buffer, length $buffer); print substr $buffer, 0, $length;