4 ms·
Or ever-so-slightly lighter Perl 6 version: my $x = 'Apple Carrot Banana'; my @y = $x.words.sort; if @y > 2 { say "we've got {@y.elems} el
by colomon 16y ago
Or ever-so-slightly lighter Perl 6 version:
my $x = 'Apple Carrot Banana';
my @y = $x.words.sort;
if @y > 2 {
say "we've got {@y.elems} elements!";
} else {
say "insufficient elements. fail.";
}
- deleted 16y ago[deleted]
- hyperbovine 16y agoIronic that the final rebuttal to "Perl looks like Java" is method chaining using periods :-) But hey, that looks very nice--glad to see Perl finally "got the dots." It's been years since I used Perl, mainly because I was squarely in the mindset of the OP. I'll have to give 6 a look.