Mostly Harmless Docs/Variables

Variables still start with a punctuation character (a “sigil”):

$  scalar
@  array
%  hash

and the sigil doesn’t change regardless of how you’re using the variable.

Some special variable names start with 2 punctuation characters (a sigil and a “twigil”) — more about those in the Special Variables section.

Lexicals still get declared using my:

my $other-car = 'a bicycle';

Variable names can now contain hyphens. Statements still end with a semicolon.

In Perl 6, OO is baked-in, everything is an object, and there’s a few methods which you can call on most objects (ex. $some-obj.some-method) which you’ll see used throughout this brief manual:

  • “WHAT” (tells you what type of object it is),
  • “perl” (returns a representation of the object that Perl 6 could read back in), and
  • “say” (prints out the object, with a newline), though we’ll often use the say function, rather than the method.

That said, OOP is not discussed here until later.


Main | Next: Context