Replace `sed` with `perl` in build-support scripts

This replaces `sed` with `perl`, as `sed` caused nasty issues with
implementations on different platforms behaving different.

When implementing these changes invoking a subshell using the
backticks-syntax didn't always work. In order to be sure, and also for
consistency reasons, all invocations of a subshell are now done using
the syntax with dollar sign parentheses.

Fixes #45.
Merge pull request #48 from KlausTrainer/fix-build-support-scripts

Replace `sed` with `perl` in build-support scripts