in reply to Shell style line-editing without benefit of CPAN modules

Rather than trying to re-invent the interactive shell-command-editor wheel, it might make more sense for the users to adapt to a slightly different procedure...

You already have a handy tool to read and execute commands via  while (<>), so think about storing one or more commands in a script file, and simply running your "CLI" tool with the script file as input (instead of the keyboard).

What you need to optimize is just the "edit/re-execute" loop. Do you have any sort of multi-window-display ability (or at least, multi-tasking job control within a single window)? Edit the file in one window, and each time you save it, re-run the command line (the same string) again to see what the output is.

(If you don't have multiple windows for multiple tasks, maybe you can run vim or dumb-term-mode emacs at the shell to edit/save the script, ^Z to background that and return to the shell so you can run the script, then "fg" to foreground the editor again as needed.)