Some of the Perl code has GUI - Graphical User Interface, many applications have a web interface, but most of the Perl code we write are command line tools.

A command line tool will get user input from two places:

  • Command line paramerers
  • Prompts on the STDOUT and responses typed in to the STDIN

Of course they also read files and databases, but the user who runs the code has those two options.

Command line parameter or command line arguments

The come in the following forms:

myapp.pl param1 param2 param3

myapp.pl --name param1 --age param2 --height param3 --debug

myapp.pl -n param1 -a param2 -h param3 -d

There are plenty of related articles. Look especially at the first two:

STDOUT/STDIN - Standart output/Standard Input

The other possibility is to ask the user questions during the run-time of the process. The code would print out a question to the screen (STDOUT or Standard Output) and the user would type in the answer that would be received by the program from the keyboard on STDIN or Standard Input.