[Purdue-pm] testing Perl 5.20

Mark Senn mark at purdue.edu
Tue Jul 8 10:38:13 PDT 2014


Thought you might be interested in a little
test file I put together to test that Perl 5.20
works...at least on a tiny bit of the stuff it
can do.  Source code is the rest of this message.    ---Mark Senn

#!/usr/new/bin/perl

use Modern::Perl;

use experimental qw 'signatures smartmatch';

use feature 'say';

my $option = undef;
$option // say 'it was undef';

$option = 0;
$option // say 'it was zero';

sub a ($a) {
    return $a;
}

sub b($x,$y){
    return $x+$y;
}

sub c ($one, $two, $three)
{
    return $one + $two + $three;
}

my $x = a(2);
say $x;

my $y = b(3,4);
say $y;

say c(5,6,7);

# I usually go without parentheses is sub calls.
say c 5, 6, 7;

my @msee130 = ('Mark', 'Curtis', 'Rich', 'Mike', 'George', 'Joe');

my $name = 'Fred';

$name ~~ @msee130  or  say "$name is not here";

# I like to set off conditions at the beginning of a line with ( ... ).
($name ~~ @msee130)  or  say "$name is not here";


More information about the Purdue-pm mailing list