---
name: "Catmandu::Fix::lookup"
section: "3pm"
platform: "linux"
package: "libcatmandu-perl"
version: "1.2024-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Catmandu::Fix::lookup"
---

# Catmandu::Fix::lookup(3pm)

change the value of a HASH key or ARRAY index by looking up its value in a dictionary

## NAME

Catmandu::Fix::lookup - change the value of a HASH key or ARRAY index by looking up its value in a dictionary

## SYNOPSIS

```
    # 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')
```

## SEE ALSO

Catmandu::Fix, Catmandu::Fix::mapping
