Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-12-2006, 07:58 AM   #1
Registered: Apr 2004
Posts: 682

Rep: Reputation: Disabled
convert bash scripts to Perl

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?
Old 09-12-2006, 08:27 AM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
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.
Old 09-12-2006, 09:42 PM   #3
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 730

Rep: Reputation: 75
Hi, noir911.

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:
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.
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).

Best wishes ... cheers, makyo

( edit 1: typo )

Last edited by makyo; 09-13-2006 at 05:16 PM.


conversion, perl, shell

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
convert while(<>) from perl to python bardinjw Programming 2 04-13-2006 09:21 AM
Convert shell scripts to other language vladmihaisima Programming 6 07-28-2005 03:25 AM
bash & perl scripts scribbler001 Programming 1 04-26-2005 05:56 AM
Howto convert Gentoo wlan scripts to Debian? Naughtyus Debian 1 02-25-2004 04:55 PM
How to Run perl scripts using bash Boudewijn Linux - Software 2 11-26-2003 04:37 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:48 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration