in reply to SPSS from Win32::OLE

You need to specify some dimensions for your array I think. From the Win32::OLE docs

To create a SAFEARRAY variant, you have to specify the VT_ARRAY flag i +n addition to the variant base type of the array elemnts. In this cas +es DATA must be a list specifying the dimensions of the array. Each e +lement can be either an element count (indices 0 to count-1) or an ar +ray reference pointing to the lower and upper array bounds of this di +mension: my $Array = Win32::OLE::Variant->new(VT_ARRAY|VT_R8, [1,2], 2) +; This creates a 2-dimensional SAFEARRAY of doubles with 4 elements: (1, +0), (1,1), (2,0) and (2,1).

Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring!

Replies are listed 'Best First'.
Re: Re: Win32
by stevegr (Initiate) on Oct 11, 2002 at 02:36 UTC
    Thanks for the reply. I'm afraid I'm getting the same result with a safearray:
    my $cwidths = Variant(VT_BSTR|VT_ARRAY, [1,371]);
    has the same effect (LastError = 0, nothing in $cwidths) and
    my $cwidths = Variant(VT_BSTR|VT_ARRAY|VT_BYREF, [1,371]);
    produces an "invalid callee" OLE error. Also as I don't know how many variables there are I actually need a dynamic array - is it possible to create one of these? Thanks, Steve