http://www.perlmonks.org?node_id=294234


in reply to An Introduction to General Systems Thinking

I wrote the following code to implement the OCCULT membership system as outlined in chapter 6:
#!/usr/bin/perl -w use strict; use diagnostics; $|++; my $total = 20; my @members = map int rand 10, (1 .. $total); my @pointers = (" ") x $total; my ($teacher, $pupil); print "@members\n"; for (1 .. 50) { do { $teacher = int rand $total; $pupil = int rand $total; } while $teacher == $pupil; $pointers[ $pupil ] = "V"; $pointers[ $teacher ] = "."; $members[ $pupil ] = ($members[$teacher] * $members[$pupil]) % 10; print "@pointers\n@members\n"; $pointers[ $pupil ] = " "; $pointers[ $teacher ] = " "; }