Do you have C algorithms you want to use from Perl? Well,
you've still got some luck on your side; it's not too
hard to put C code into a compiled module that can be used from Perl.
In fact, any language that compiles to make object code can generally
be used to make a module. See the perlxs
manpage, and the Inline module, as well as the
SWIG system.
Do you have a shell script that you want to convert to Perl? Your
luck just ran out. There's no automatic way to convert shell to
Perl. That's because the shell hardly does anything by itself;
it spends all of its time running other programs. Sure, we could make
a program that would mostly just call system for
each line of the shell, but that would be much slower than just
letting the shell do things in the first place. It really takes a
human-level of intelligence to see how the shell's use of
cut, rm,
sed, awk, and
grep can be turned into efficient Perl code.
It's better to rewrite the shell script from scratch.
 |  |  |
B.24. Embedding |  | B.26. Converting find Command Lines to Perl |