In any programming language, variables are named pieces of memory that you can use to store a value as well as retrieve it. In Perl 6, a variable is a container that can host a value of one of the types, either built-in in the language or created by the user.
Using variables
Declaring variables
Every variable must be declared before its use in the program. You don't need to declare all the variables at the beginning of the program. From a practical perspective, the point of declaration can (and should) be as close as possible to the place where it is first used. The most practical reason to do that is to make the visibility of the variable better—if you declare too early, you force the reader of your program to...