Introduction to Perl 6 screencast - part 1 - scalars

This article is about Perl 6. If you are looking for solution regarding the current production version of Perl 5, please check out the Perl tutorial.


Direct link to the Perl 6 scalars screencast

Rakudo

IRC: #perl6 on irc.freenode.net

Perl 6 Code examples


  use v6;
  say "Hello world";


  use v6;
  my $name = prompt "Please type in your name: ";
  say "Hello $name, how are you?";


  use v6;
  my $year = prompt "When were you born? ";
  if $year > 1987 {
    say "You are younger than Perl by { $year - 1987 } years";
  }


  use v6;
  my $year = prompt "When were you born? ";
  if 1995 > $year > 1987 {
    say "You are younger than Perl 1 but older than Perl 5";
  }



  use v6;
  my $luck = prompt "What is your lucky number? ";
  if $luck == 3 or $luck == 7 or $luck == 13 {
    say "Oh, that's like mine";
  }

  if $luck == 3|7|13 {
    say "Oh, that's still like mine";
  }