An attempt at sarcasm. Epic fail, apparently :)
]]>wasanzy asked for help
Shells suggested something that's a really bad idea
apeiron corrected this
Shells, apeiron and I discussed it until Shells understood why it was a bad idea
We and various other channel members helped wasanzy find a good solution to their problem
As such, I'm reasonably confident that people wanting help writing good perl will not have been put off by the conversation.
We would vigorously oppose anybody suggesting that the solution to a missing 'my' declaration was to remove 'use strict'; CGI.pm is, compared to the alternatives that obsolete it, just as much of a bug source in the long run.
]]>$ perl6 --version
This is perl6 version 2013.09 built on parrot 5.5.0 revision 0
$ sysctl -a | grep machdep.cpu.brand.string
machdep.cpu.brand_string: Intel(R) Core(TM) i5-2557M CPU @ 1.70GHz
$ time perl6 stuff.p6
My multiples are: 3 5 6 9 10 12 15 18 20 21 24 25 27 30 33 35 36 ... *snip* ... 993 995 996 999
Total: 233168
real 0m1.289s
user 0m1.037s
sys 0m0.220s
real 0m0.064s
user 0m0.010s
sys 0m0.015s
So my Mac has a slower time for the Perl 5 code so I'd imagine the OP would have a slightly better time than 1s for the Perl 6 code running in the latest R* parrot build?
]]>sub MAIN( Int $max = 1000 )instead, you'll even get a helpful error message if the user writes "over nine thousand" instead of a number.
Also, for interpolating arrays into strings, you can also just write
"My multiples are: @multiples[]".say;
And another thing: I think "1 ..^ $max" looks prettier than "1 .. $max-1".
]]>unless any(@multiples) $start {
That looks like TTIAR (two terms in a row) to me (syntax error).
]]>It is not that difficut to include instructions for those who want to port their CGI scripts.
Something like
sudo cpan CGI
will do the trick ;)
I think Perl can move on and remove CGI.pm from core modules.
What it is really missing in the core, in my opinion, are IO::Socket::SSL and Plack.
Look at Node.js core, for example http://nodejs.org/api/tls.html
We need https!
That's actually deliberate. Perl 6 does have a type inference engine in the optimizer. However, type inference can often generate obscure errors that are hard to understand. Larry Wall has said that until they have a better handle on how to present those errors without dumping a mathematical proof on the user, many errors will remain runtime errors instead of compile time errors.
Thus, simple cases like the one you've found will probably be added in the future, it's hard to say how far the Perl 6 devs will go with this.
]]>One question though, about this code:
die unless $_[0] =~ /^\d+$/;
One obvious bug is that it will accept octal numbers such as "040". Will the Perl6 "Int" type prevent such numbers?
]]>This actually looks very promising. Although it's a bit worrisome that I need a specially built perl
... that seems to imply that Perl6 will be shelling out to Perl5 via a system
call or somesuch. Which may have performance implications.
But, nonetheless, this is something I wish the Perl 6 folks at YAPC would have been more vocal about. I think it would go a long way towards allaying people's fears.
]]>https://github.com/kyclark/metagenomics-book/tree/master/perl6/fastq-read-pair
I should also have elaborated on the problem. Usually the R1/R2 files have each read's forward/reverse (respectively) mate in the same order/location. That is, in the raw FASTQ files, read 1 will be the first in R1/R2, then read 2, always in ascending order. But after QC, R1 might start on read #10 because the first nine forward reads were bad while R2 might start on read #2, then jump to read #7, etc. After QC, the pairing is off. Only when you find a mate pair (same read number) can you write them back into their respective R1/R2 out files; otherwise the unmated read goes into the singletons file.
Does that make sense?
]]>.slurp
and .slurp-rest
The IO
object has a .split
method that doesn't have to read the entire contents of the file before splitting the file up.