Документ взят из кэша поисковой машины. Адрес оригинального документа : http://hea-www.harvard.edu/~dburke/perl-slang/typedef_struct_example
Дата изменения: Fri May 9 18:23:10 2003
Дата индексирования: Tue Oct 2 05:06:57 2012
Кодировка:

Поисковые слова: arp 220
use strict;
use Inline 'SLang';

my $s = get_struct("foo");
print "get_struct() returned a $s - and ref(\$s) = " . ref($s) . "\n\n";
print "Structure contents:\n";
while ( my ( $key, $value ) = each %{$s} ) {
print " key $key\t has a value of $value\n";
}
print "\n";
$$s{afield} = 'a changed field value';
print "Key afield now has a value of [$$s{afield}]\n";

__END__
__SLang__

typedef struct { xfield, afield } Example_Struct;
define get_struct(x) {
variable out = @Example_Struct;
out.xfield = x;
out.afield = strlen(x);
return out;
}