Learn about coercion and its types.

Throughout the lifetime of a Perl variable, it may contain values of different types—strings, integers, rational numbers, and more. Instead of attaching type information to variables, Perl relies on the context provided by operators to determine how to handle values. Perl attempts to do what we mean (we may hear this referred to as DWIM for “Do what I mean” or “Dwimmery”), though we must be specific about our intentions. If we treat a value as a string, Perl will do its best to coerce that value into a string.

Get hands-on with 1200+ tech skills courses.