use strict; use warnings; $|++; my $counter = 1; print "($counter) "; while () { chomp; if ($_ eq "error") {print "Error on command #$counter\n";} if ($_ eq "commit") {print "Committing data\n";} if ($_ eq "exit") {print "Exiting program...\n"; exit;} $counter++; print "($counter) "; }