while ( (print "Enter Command: "), (my $line = ) !~ /^\s*q(uit)?\s*$/i ) { next if $line =~ /^\s*$/; #skip new lines next if $line =~/^\s*skip/i; #skip is a no op command insert if $line =~/^\s*insert/i; #do insert command delete if $line =~/^\s*delete/i; #do delete command #...etc.. } sub insert() {...} sub delete() {...}