From mark at purdue.edu Tue Jul 8 10:38:13 2014 From: mark at purdue.edu (Mark Senn) Date: Tue, 08 Jul 2014 13:38:13 -0400 Subject: [Purdue-pm] testing Perl 5.20 Message-ID: <38851.1404841093@pier.ecn.purdue.edu> 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"; From bradley.d.andersen at gmail.com Tue Jul 8 10:41:29 2014 From: bradley.d.andersen at gmail.com (Bradley Andersen) Date: Tue, 8 Jul 2014 13:41:29 -0400 Subject: [Purdue-pm] testing Perl 5.20 In-Reply-To: <38851.1404841093@pier.ecn.purdue.edu> References: <38851.1404841093@pier.ecn.purdue.edu> Message-ID: I would not use smartmatch operator if it can be avoided: http://blogs.perl.org/users/brian_d_foy/2011/07/rethinking-smart-matching.html I think grep does the same thing just as easily. Haven't checked speed though. /bda On Tue, Jul 8, 2014 at 1:38 PM, Mark Senn wrote: > 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"; > _______________________________________________ > Purdue-pm mailing list > Purdue-pm at pm.org > http://mail.pm.org/mailman/listinfo/purdue-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bradley.d.andersen at gmail.com Tue Jul 8 10:42:57 2014 From: bradley.d.andersen at gmail.com (Bradley Andersen) Date: Tue, 8 Jul 2014 13:42:57 -0400 Subject: [Purdue-pm] testing Perl 5.20 In-Reply-To: References: <38851.1404841093@pier.ecn.purdue.edu> Message-ID: Also, you can do cool things like this more tersely, but still readably: my $blah //= .. and it'll do the right thing On Tue, Jul 8, 2014 at 1:41 PM, Bradley Andersen < bradley.d.andersen at gmail.com> wrote: > I would not use smartmatch operator if it can be avoided: > > http://blogs.perl.org/users/brian_d_foy/2011/07/rethinking-smart-matching.html > > I think grep does the same thing just as easily. Haven't checked speed > though. > > /bda > > > > On Tue, Jul 8, 2014 at 1:38 PM, Mark Senn wrote: > >> 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"; >> _______________________________________________ >> Purdue-pm mailing list >> Purdue-pm at pm.org >> http://mail.pm.org/mailman/listinfo/purdue-pm >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jacoby.david at gmail.com Wed Jul 9 08:19:31 2014 From: jacoby.david at gmail.com (Dave Jacoby) Date: Wed, 9 Jul 2014 11:19:31 -0400 Subject: [Purdue-pm] Question about Versions Message-ID: We might go into this deeper on Tuesday (less than a week until the next Perl Mongers meeting! See you at 11:30 in WSLR 116!), but this is an issue I'm having. In Javascript, when I include a library I wrote, I put