Name

Complete

Synopsis

Complete ('prompt_string', array)

Sends string to the currently selected filehandle, reads the user’s response, and returns the response. Takes the following arguments:

prompt_string

The prompt for user input

array

The array of words against which the user’s input is matched

If any of the following characters are included in the user’s response to prompt_string, they are treated as special characters:

Tab

Does word completion, matching what the user has typed so far against the list of strings in completion_list. On a unique match, outputs the rest of the matched string and waits for the user to press Return. Otherwise, leaves partial input unchanged and sounds the bell.

Ctrl-D

Prints all possible completions of the user’s partial input, or the entire completion list if the partial input string is null, and reissues the prompt string and the partial input. Redefine by setting the variable $Term::Complete::complete.

Ctrl-U

Erases any partial input. Redefine by setting the variable $Term::Complete::kill.

Del, BS

Delete and backspace characters; both erase one character from the partial input string. Redefine by setting the variables $Term::Complete::erase1 and $Term::Complete::erase2.

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.