Catman...x::int(3pm)

πŸ“¦
version 1.2025 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

✨ NAME ✨

Catmandu::Fix::int β€” bestie, this one converts a value to an integer. That's it, that's the whole job, and she does it flawlessly πŸ’…

This page lives in the User Contributed Perl Documentation section, and its full manual-page name is Catman...x::int(3pm) in case you were wondering where you even are 🫢


πŸŽ€ SYNOPSIS πŸŽ€

okay so watch her work, she's so clean:

# 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

like. look at that. a string that's just a number becomes the number ("2016" β†’ 2016) ✨, a messy string with digits hiding inside gets dragged into being one ("bar-123baz" β†’ -123) πŸ’€, an empty string goes to 0, pure nonsense text goes to 0, an empty array goes to 0, and a non-empty array or a hash just tells you how many things are in it (["a", "b", "c"] β†’ 3, {a => "b", c => "d"} β†’ 2). she's giving "I contain multitudes but also I am one integer" energy πŸ‘‘


πŸ¦‹ SEE ALSO πŸ¦‹

  • Catmandu::Fix β€” the whole fix fam, go say hi πŸ’–

and that's the whole page, bestie, no cap πŸ“

this was brought to you by perl v5.40.1, dated 2026-01-24 β€” the very same Catman...x::int(3pm) you just read, slaying since forever 🌸

mwah πŸ’‹ go fix something iconic ✨

πŸ“¦ where this page comes from