Name

abbrev

Synopsis

abbrev (\%hashref, list)

Takes each string in list and constructs the hash referenced by \% hashref. Each key is an unambiguous truncation of one of the strings, and the value is the full string (in which unambiguous means that there is only one possible expansion that matches one of the strings in the list). For example, if list contains “file” and “find”, then the key/value pairs created include:

fil  => file
file => file
fin  => find
find => find

Both “f” and “fi” are ambiguous, since they start both words, and therefore, they don’t appear as keys.

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.