HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/share/doc/libchatbot-eliza-perl/examples/twobots
#!/usr/bin/perl

# In this example, we create two bots, and have them
# talk to each other.   This program exposes the 
# weaknesses of the default "psychiatrist" script. 
# This would be more interesting with better scripts.

use Chatbot::Eliza

my ($harry, $sally, $he_says, $she_says);

# Turn autoflush on, so we can watch 
# the output as it is produced. 
$|=1; 

# Seed the random number generator. 
srand( time ^ ($$ + ($$ << 15)) ); 

$sally = new Chatbot::Eliza "Sally";
$harry = new Chatbot::Eliza "Harry";

$he_says  = "I am sad.";

my $loopcount = 5;

for ($i=0; $i < $loopcount; $i++) {

	$she_says = $sally->transform( $he_says );
	print $sally->name, ":  $she_says \n";

	$he_says  = $harry->transform( $she_says );
	print $harry->name, ":  $he_says \n";

}

1;