#! /usr/bin/perl -w # read command and process it # illustrates interactive program $prompt = "Command (or \"exit\"): "; print $prompt; while () { chop; if ($_ eq "exit") {exit 0; } system $_; unless ($? == 0) { print "error executing :$_\n"; } print $prompt; }