in reply to Re^2: Help me update stubborn perlfaq answers!
in thread Help me update stubborn perlfaq answers!
------------- |int|int|int| -------------You can then unpack it with because you know the size of each element in the string.
#pack work = sv_2mortal(newSVpv("", 0)); for (i=0; i<=n; i++) { work2 = av_fetch( array, i, 0 ); /* Fetch */ if (work2==NULL) nval = 0.0; /* Undefined * else { if (SvROK(*work2)) goto errexit; /* Croak if reference [i.e. not 1D] */ nval = SvNV(*work2); } iscalar = (int) nval; sv_catpvn( work, (char *) &iscalar, sizeof(int)); } #unpack for (i=0; i<m; i++) { av_store( array, i, newSViv( (IV)ivar[i] ) ); }
|
---|