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

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

convert a value to an integer

## NAME

Catmandu::Fix::int - convert a value to an integer

## SYNOPSIS

```
    # year => "2016"
    int(year)
    # year => 2016
    # foo => "bar-123baz"
    int(foo)
    # foo => -123
    # foo => ""
    int(foo)
    # foo => 0
    # foo => "abc"
    int(foo)
    # foo => 0
    # foo => []
    int(foo)
    # foo => 0
    # foo => ["a", "b", "c"]
    int(foo)
    # foo => 3
    # foo => {a => "b", c => "d"}
    int(foo)
    # foo => 2
```

## SEE ALSO

Catmandu::Fix
