Try Perl6 Beta
Inspecting Types

So far we've played with strings and numbers, but we haven't really peeked into the actual types of those things.

You can inspect what type something is by calling .WHAT on it

Let's see some examples:

  • "Hello World".WHAT
  • 5.WHAT
  • pi.WHAT
  • (1/3).WHAT
  • (0.1 + 0.3).WHAT

Perl6 has a type system and lets you examine the type of pretty much anything.

Examining types will help us understand many other features of the language.

Terminal