Is there any way (tool) to migrate/convert c code to perl ?
None that I know of. If there was such a tool, I probably wouldn't use
it, and I certainly wouldn't trust it.
There are many things that work in C, are very idiomatic, but which
are just not the right way to approach things in Perl. There are
things that are possible in C, and simply not possible at all in Perl.
For example, walking a string in C by incrementing a pointer until you
reach a null byte, is normal in C. In Perl, that is not what you do.
Another example is the use of machine-specific register tricks, or
machine-specific address tricks. In (machine-specific variants of) C
you can set a pointer to a fixed address, which is meaningful to the
machine, and then manipulate or read that address. You can't do that
in Perl.
Trying to translate C into Perl on a code line by line basis will
always end up with bad code, and most often with something ugly,
unmaintainable, if it is possible at all.
If you can't rewite the logic in Perl, maybe you should try to make
your C code available as a library, and provide some access points to
this library to Perl, with XS, SWIG, Inline::C or soemthing like that.
The question is: Why do you want to rewrite it? The best option
depends on the answer you give to that question.
Martien