ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm planning to convert most of my system related scripts from bash to Perl. I looked at the book - Perl for System Administration and didn't find it very helpful. Most of the scripts over there are dependent on CPAN modules whereas I want to keep things simple without having to depend on CPAN modules. Is there any useful online resources where I can get Perl codes related to system administration?
what kind of modules? CPAN holds virtually all common perl scripts, these aren't unsual modules or anything. many of them will already be on your system, or prepackaged within rpm's or other formats for your packaging system.
The success of the conversion probably will depend to a large degree on what it is that you're doing.
I remember thinking I should do the same thing. From an old FAQ on perl:
Quote:
How can I convert my shell script to Perl? ...
Actually, there is no automatic machine translator. Even if there were, you wouldn't gain a lot, as most of the external programs would still get called. It's the same problem as blind translation into C: you're still apt to be bogged down by exec()s. You have to analyze the dataflow and algorithm and rethink it for optimal speedup. It's not uncommon to see one, two, or even three orders of magnitude of speed difference between the brute-force and the recoded approaches. http://www.perl.com/doc/FAQs/FAQ/oldfaq-html/Q5.19.html
This is not to say that you can't or shouldn't, only that you may need to think about things. Sort of like "render unto the shell the things which are the shell's" (with apologies for the paraphrase to the Dictionary of Cultural Literacy).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.