Caleb Cushing's Blog

Simple scripting CLI with Expect.pm

Expect is use primarily for sending Input to Command Line programs that Prompt and wait for input. For starters you’ll need an executable script and I’ve pasted one that I got elsewhere for a demo. #!/usr/bin/env perl # slightly modified from http://www.tizag.com/perlT/perluserinput.php use 5.014;; use warnings; print “How old are you?”; my $age = <>; print “What is your favorite color?”; my $color = <>; say “You are $age, and your favorite color is $color. Read more →