Документ взят из кэша поисковой машины. Адрес оригинального документа : http://hea-www.harvard.edu/~dburke/perl-slang/array_example
Дата изменения: Thu May 8 20:57:16 2003
Дата индексирования: Tue Oct 2 01:57:13 2012
Кодировка:
use strict;
use Inline 'SLang';
use Data::Dumper;

# ensure that we convert S-Lang arrays to array references
Inline::SLang::sl_array2perl(0);

my $a1 = send_and_get( [ "hi", "there", "", "a string" ] );
print "\nPerl sent:\n", Dumper($a1), "\n";

__END__
__SLang__

define send_and_get (in) {
if ( typeof(in) != Array_Type ) error( "Error!" );
variable adims, ndims, atype;
( adims, ndims, atype ) = array_info(in);
vmessage( "S-Lang sent a %d dim array of %S variables", ndims, atype );
variable elem;
foreach ( in ) {
elem = ();
vmessage( " element = '%S'", elem );
}

% create the output array
variable out = [2:7];
reshape( out, [2,3] );
return out;
}