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

# Catmandu::Fix::sort\_field(3pm)

sort the values of an array

## NAME

Catmandu::Fix::sort\_field - sort the values of an array

## SYNOPSIS

```
   # e.g. tags => ["foo", "bar","bar"]
   sort_field(tags) # tags =>  ["bar","bar","foo"]
   sort_field(tags, uniq: 1) # tags =>  ["bar","foo"]
   sort_field(tags, uniq: 1, reverse: 1) # tags =>  ["foo","bar"]
   # e.g. nums => [ 100, 1 , 10]
   sort_field(nums, numeric: 1) # nums => [ 1, 10, 100]
   #push undefined values to the end of the list (default)
   #beware: reverse has no effect on this!
   sort_field(tags,undef_position: last)
   #push undefined values to the beginning of the list
   #beware: reverse has no effect on this!
   sort_field(tags,undef_position: first)
   #remove undefined values from the list
   sort_field(tags,undef_position: delete)
```

## SEE ALSO

Catmandu::Fix
