#!/usr/bin/perl use strict; use warnings; my @response = ( "That's interesting.", "Eh, boring...", "Ugh.", "Cool! Keep up the good work!" ); chat('April', @response); sub chat { my ($my_name, @responses) = @_; print "Hi, my name is $my_name! What's yours? "; chomp(my $name = ); print "Hi $name, nice to meet you! What are you up to? "; my $response = ''; until ($response eq 'nothing') { chomp($response = ); print $responses[rand @responses], "\n"; print "Anything else? "; } print "Goodbye, $name!\n"; }