Catman...x::int(3pm)
β¨ 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
- ubuntu resolute: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms