is foo(2, 3), 6, "multiplication works";
Getting the code right once is enough work...
]]>.
(dot): say "-"."x"
. (Indeed, say a"x"
produces no output — confusing unless you turn on warnings).
And something like say 1+"x"
prints 1; Perl turns the string to a 0 (and prints a warning if enabled) — in every math operator but unary +/-. Perl doesn't do algebra.
So I find it weird (but documented, and useful) that 2, 3, and 4 don't all print 0.
]]>It shouldn't be on semi-recent hardware (which has AES support). On my not-so-recent box, openssl speed -evp chacha20 gets 1.6GB/sec with big blocks, but … -evp aes-128-ctr gets 5.1GB/sec. Even aes-256-ctr gets 3.6GB/sec.
I'm not sure those are the exact right EVP arguments to give it to test, but the presence of dedicated AES hardware makes AES the fastest option, almost always.
]]>make_upper_caser_iterator
example, I'm pretty sure that $fh
becoming unreferenced closes the file anyway. So the explicit close isn't needed (except, of course, that you could check the result and handle errors). Also, if your file handle is valid in the child process, you want to close it there too—fork copies file handles, too.
A neat trick, but I think in a lot of cases RAII handles this better as it's tied to the data involved, not just function exit. Of course, sometimes you really do want cleanup for a function.
PS: Watch out for your cleanup-objects accidentally getting sucked into closures. That could lead to very unexpected outcomes.
]]>say "2 + 2 = @{[2 + 2]}"; # "2 + 2 = 4"
That has worked in perl5 for quite a while—I think the newest feature used there is "say".
]]>