Chapter 2. First steps in Perl6

2.1. Hello World - scalar variables

Strings can be stored in so called scalar variables.
Each such variable starts with a $ sign and then alphanumeric characters and underscore.
Before using such a variable the first time one has to declare it by the my keyword.

my $this_is_a_variable;
my $ThisIsAnotherVariableButWeDontLikeItSoMuch;

Variables are case sensitive.

my $h;
my $H;

Example 2-1. examples/scalars/hello_world_variable.p6

#!/usr/bin/perl6

my $greeting = "Hello World";
say $greeting;

By default scalar variables have no specific types but later we will see how
can we restrict the values a scalar can hold to an Int or Str.