1#!perl 2use strict; 3use warnings; 4$| = 1; 5 6my $what = (shift @ARGV) || "there"; 7print "* Hi $what, to read\n"; 8 9while (1) { 10 print "read: "; 11 my $command = <>; 12 chomp $command; 13 14 if ($command eq 'ping') { 15 print "pong\n"; 16 } elsif ($command eq 'quit') { 17 exit; 18 } 19} 20