I want it to ... present the name of the command, wait for the user, then print the description, wait for the user, ad infinitum.
That makes sense, but I think that passing the output of whatis to your program via @ARGV is not the right way to go, one reason being that command-line arguments are generally split on whitespace, whereas you would have a much easier time parsing the output of whatis on a line-by-line basis, and then parse each line with a regex (or split).
There are other methods to get the output of external programs into your Perl script, practically all of which can automatically split the input into lines. The simplest is backticks (``), aka qx, and it's built in to Perl, but that can have issues with shell quoting (and thereby security, depending on usage) and error handling. So I'd recommend using a module, such as: capture from IPC::System::Simple, run3 from IPC::Run3, or capture from Capture::Tiny (there are a couple more but I like these the best).
Instead, I might use @ARGV to allow the user to pick which commands they want to be quizzed on, e.g. perl bashflash dd echo cp or perl bashflash /bin/* - note that for the latter, fileparse from File::Basename is useful to get only the name of the command.
In reply to Re: Seeking regexp @ARGV arrays Wisdom
by Anonymous Monk
in thread Seeking regexp @ARGV arrays Wisdom
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |