This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl -w | |
my $hashref = { | |
# | |
# POD may not appear here | |
# | |
p => sub{ | |
=pod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use List::Util qw(reduce); | |
my @in = (1,2,3,4,5,6,8,9,10,12,16,17,18,21); | |
print join (',', | |
map { defined $_->[1] ? "$_->[0]..$_->[-1]": $_->[0] } | |
@{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
my @LINES = qw(artichoke beetroot cabbage); | |
while (my $in = shift(@LINES)) { | |
my $results = []; | |
sub result { | |
push @$results, shift; | |
} | |
result(uc $in); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
my @comparanda; | |
my @similar; | |
my $opts = {}; | |
@similar = grep { 0 == ($a->{$opts->{'name'}} cmp $b->{$opts->{'name'}}) } @comparanda; # case 1 - this is what I mean | |
@similar = grep { (0 == $a->{$opts->{'name'}}) cmp $b->{$opts->{'name'}} } @comparanda; # case 2 - I can see why perl might think this | |
@similar = grep { 0 == $a->{$opts->{'name'}} cmp $b->{$opts->{'name'}} } @comparanda; # case 3 is either 1 or 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r MyWeb-App/lib/MyWeb/App.pm MyWeb-App-2/lib/MyWeb/App.pm | |
3c3 | |
< | |
--- | |
> set serializer => 'JSON'; | |
9a10,14 | |
> post '/test/' => sub { | |
> my $data = from_json( param('json'), {utf8 => 0}); | |
> return { msg => $data->{q} } | |
> }; |
NewerOlder