2

How can I convert a shell script into a Perl script?

I have a 10k line shell script and want to convert it into Perl. Is there any tool is doing that, or is there any way to do that?

0

2 Answers 2

12

There is no simple converter. From Perl FAQ "How-can-I-convert-my-shell-script-to-perl?"

Learn Perl and rewrite it. Seriously, there's no simple converter. Things that are awkward to do in the shell are easy to do in Perl, and this very awkwardness is what would make a shell->perl converter nigh-on impossible to write. By rewriting it, you'll think about what you're really trying to do, and hopefully will escape the shell's pipeline datastream paradigm, which while convenient for some matters, causes many inefficiencies.

Sign up to request clarification or add additional context in comments.

1 Comment

+1 for giving essentially the same answer as David Dorward but a) with some backup and b) some tact
9
  1. Learn whichever shell language the script is written in
  2. Learn Perl
  3. Translate the code

1 Comment

This is actually the best answer possible I'd think.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.