Perl v5.28 updates to Unicode 10. There are 8,518 new characters, 7,473 which are in the CJK extension. There are 56 new emojis. And, the Bitcoin symbol, ₿. It adds a T. rex, 🦖, but we’re still waiting for a raptor. To Perl they are just characters like any other so you don’t need anything new to deal with them.
Month: August 2018
Find the new emojis in Perl’s Unicode support
Perl v5.26 updates itself to Unicode 9. That’s not normally exciting news but people have been pretty enthusiastic about the 72 new emojis that come. As far as Perl cares, they are just valid code points like all of the other ones.
Continue reading “Find the new emojis in Perl’s Unicode support”
Avoid perl housekeeping for hot loop optimization
David Golden gave a talk at The Perl Conference 2017 where he showed Real World Optimization for the MongoDB Perl driver. He spoke about many big performance gains and you can watch the talk for that, but at the end he talked about various micro-optimizations.
Small gains in “hot loops” (code that executes many, many times) can add up to significant savings. David was able to cut off 20% of the runtime with some of these micro-optimizations. All of these are his ideas but they are the very thing the Effective Perl programmer is curious about.
Continue reading “Avoid perl housekeeping for hot loop optimization”
Perl v5.28 can delete key-value slices
Perl v5.20 introduced key-value slices that worked on hashes and arrays. You could extract values by their keys or indices as well as assigning to those.
The key-value slice delete is way to extract the keys and values you want and delete them at the same time. You can destructively
Continue reading “Perl v5.28 can delete key-value slices”
Initialize array and hash variables with state
Perl v5.28 allows you to initialize array and hash variables that you declare with state
. This is a feature a long time coming and that I’m quite happy as finally arrived.
Since v5.10 and up to v5.26 you could only initialize a state
variable if it was a scalar. You could declare a hash or array variable but you couldn’t give it an initial value at the same time. You could do this:
Continue reading “Initialize array and hash variables with state”