Catmandu::Fix::lookup(3pm)

Catmandu::Fix::lookup3pm

Change the value of a hash key or array index by looking up its value in a dictionary

Usage

    # dictionary.csv
    # id,planet
    # 1,sun
    # 2,earth
    # 3,moon
    # values found in the dictionary.csv will be replaced
    # {foo => {bar => 2}}
    lookup(foo.bar, dictionary.csv)
    # {foo => {bar => 'earth'}}
    # values not found will be kept
    # {foo => {bar => 232}}
    lookup(foo.bar, dictionary.csv)
    # {foo => {bar => 232}}
    # in case you have a different seperator
    lookup(foo.bar, dictionary.csv, sep_char: |)
    # delete value if the lookup fails:
    lookup(foo.bar, dictionary.csv, delete: 1)
    # use a default value if the lookup fails:
    lookup(foo.bar, dictionary.csv, default: 'default value')

Releases

6 releases since Debian 8 (Jessie); the text changed 5 times.

  1. 8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13

From libcatmandu-perl 1.2024-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.