Compiling scripts with pp, PAR’s helper script, to executable binaries (.exe files on Win32) should be a pretty straightforward process. Anyway, if you are developing GUI applications, probably with Wx, you will surely run into some problems.
Upon execution, the generated execs will complain about missing libraries, DLLs or similar. This is because pp does a […]
There is a handy short version for a classic if-else-statement that is very useful, but everytime I’d like to use it, I just can’t fully remember what its syntax was. And looking it up on google is hard, because “if” is a very common word… It is especially useful on initializing variables in a cgi […]
Recently, I had to wrangle a large dataset, with over 3 million key-value pairs. I need to iterate over them in a sorted way and I needed the hash-structure to weed out “already-seen-keys”.
My first approach was to build a hash in memory, with the usual my %hash, then adding keys and values in a giant […]
A quick reminder:
How do I pad a string so that a number or string gets leading zeros?
Answer:
By using sprintf:
my $number = 123;
$number = sprintf(”%07d”, $number);
print $number;
Output: “0000123″
after the %: “0″ is the character to add, <number>d is the amount of digits (that’s why it’s “d”) to add. See the documentation for sprintf.
When you use ffmpeg to transcode videos from various sources and in various sizes, formats and aspect ratios to a given destination format, you can’t rely on ffmpeg alone to produce the expected results. In this post we will have a look at how we can dynamically letterbox or pillarbox (black bars on the sides […]
Writing a large-scale web-crawling and web-indexing search engine from scratch is a large beast to tame and in many cases a project that is heading for desaster right from the start. As you can read in Alex’s worklog for the ongoing effort to manage the Majestic-12 distributed search engine, writing a crawler alone can cost […]
As you can see from reading this discussion, installing a cpan module, without root access, can be daunting. When you managed to install your own compiled Perl on a non-root account, this is in most cases earlier or later the next step/problem. Do this:
login via ssh
ssh remotehost.com -l myusername
create these directories:
myperl/man
myperl/man/man1
myperl/man/man3
then start your perl and […]
In this blog, I’d like to publish trick, tips and hints related to the scripting/programming language Perl, which should not be confused with PEARL.
Although the origin of the name Perl are a more adventurous story, today most agree that Perl stands for Practical Extraction and Report Language, which summarises quite well what it does but […]