Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 870d189bbc
Fetching contributors…

Cannot retrieve contributors at this time

file 37 lines (18 sloc) 0.604 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#!./parrot perl6.pbc

# check variables

use v6;

say '1..12';

my $o1 = 'ok 1'; say $o1;

my $o2; $o2 = 'ok 2'; say $o2;

my $a = 3; print 'ok '; say $a;

my $b; $b = 4; print 'ok '; say $b;

our $x = 5; say 'ok ', $x;

{ my $x = 6; say 'ok ', $x; };

if ($x + 2 == 7) { say 'ok ', $x + 2; }

{ my $x = 999; { our $x; say 'ok ', $x + 3; } }


## variable interpolation in strings

$b = 9; "ok $b" eq 'ok 9' and say 'ok 9';

'ok $b' ne 'ok 9' and say 'ok 10';

$b = "0x0b"; "ok $b" eq 'ok 0x0b' and say 'ok 11';


## nested 'our' declarations

$x = 'not ok 12'; { our $x = 'ok 12'; }; say $x;
Something went wrong with that request. Please try again.