Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Is Perl really worth to learn?

  1. #1
    Senior Member
    Join Date
    Jun 2007
    Location
    Hyderabad, AP, India
    Posts
    806
    Thanks
    44
    Thanked 55 Times in 48 Posts
    Rep Power
    13

    Default Is Perl really worth to learn?

    Hi all,

    I am facing so many compatibility issues in using Bash shell scripting even with in linux such as redhat 4,5 and ubuntu there are many difference which is irritating me . I hear that Perl is good for automating Admin task.. Can any one share your experience on Perl and Bash shell scripting..

    PS:if you feel this is not appropriate forum, move it to shell scripting forum..
    Thanks,
    Surendra Kumar Anne
    Linux: Fast, friendly, flexible and .... free!
    Support Open source.
    http://www.linuxnix.com

  2. #2
    Contributors jaysunn's Avatar
    Join Date
    Apr 2009
    Location
    NYC - USA
    Posts
    1,029
    Thanks
    165
    Thanked 154 Times in 133 Posts
    Rep Power
    24

    Default

    For what I can say,

    I like bash for quick and dirty automation / manipulation of data. However for creating fast more robust programs you will want to use something like PERL, PYTHON or RUBY in my humble opinion.

    The problem that I faced with perl and python and ruby is that I always start to learn perl then it gets to advanced so I give up and move onto python etc...

    I finally picked one language and stopped moving around. I am learning ruby as my language for its easy learning curve. It works well with calling linux commands and shell scripts.

    I guess what I am trying to say is pick one language and learn it. It will help you in your systems administration tasks tremendously.

    Here is a neat ruby for sys admins link.

    http://www.ibm.com/developerworks/ai...min/index.html
    JAYSUNN
    Last edited by jaysunn; 27th March 2010 at 08:49 PM. Reason: added link for ruby sysadmins

  3. The Following User Says Thank You to jaysunn For This Useful Post:

    kumarat9pm (27th March 2010)

  4. #3
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,515
    Thanks
    17
    Thanked 814 Times in 511 Posts
    Rep Power
    10

    Default

    Yes go for it.

    I've not faces much problem with bash either but YMMV.

    Can you share your compatibility problems with bash?

    ruby is not installed by default on many unix and Linux distros by default. On other hand Perl (and Python due to RHEL admin tools) is almost guaranteed. Hence Perl is recommended for sys admin tasks. Perl and Python also presents on many recovery tools. But I'm not sure about ruby...
    Code:
    uname -mrs
    Linux 2.6.18-164.15.1.el5 x86_64
    Code:
     whereis python
    whereis perl
     whereis ruby
    You may argue that - I can install ruby too on production box. Sure you can, but remember less software is good when it comes to security. Having said that select one tool and stick too it just like distro.

    Edit: Finally, CPAN is the main reasons to use Perl for sys admin tasks. It has huge collections of libs. Also, if you are looking to take UNIX admin job in big IT companies or fortune 1000 compaines such as Yahoo, Google, HP, Cisco or Financial or Government, DoD sector Perl rulez.

    Good luck!
    Last edited by nixcraft; 27th March 2010 at 08:55 PM.
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  5. The Following 3 Users Say Thank You to nixcraft For This Useful Post:

    jaysunn (27th March 2010), kumarat9pm (27th March 2010), meta (29th March 2010)

  6. #4
    Contributors jaysunn's Avatar
    Join Date
    Apr 2009
    Location
    NYC - USA
    Posts
    1,029
    Thanks
    165
    Thanked 154 Times in 133 Posts
    Rep Power
    24

    Default

    @ Nixcraft,

    Can you suggest a task that I can attempt to achieve with perl. I find that I learn much easier if there is a task at hand.

    I mean I am sure I can try to make a backup program of some sort. However have you or anyone created a perl program that you use daily?

    I would love to try to mimic it on my own without copying and pasting it.

    Jaysunn

  7. #5
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,515
    Thanks
    17
    Thanked 814 Times in 511 Posts
    Rep Power
    10

    Default

    Yes, I've done lots of project using Perl.

    If you try to write backup or simple script in Perl you are NOT going to like it as those tasks are pretty easy in KSH or Bash.

    Just 2 week ago I finished LDAP directory server automation and integration with Postfix, Apache and other services. Here is something simple I'm working on right now, there is a text file which is updated everyday as follows (new domains added, updated or deleted) of like 30 web servers from command server:
    Code:
    username|domainname|DocRootPath|TargetHost|ip:port,ipv6:port|ftpAccess|sftpAccess|sshAccess|phpAccess|PerlAccess|JavaAccess|PythonAccess
    My perl programs reads above file and make changes to TargetHost (another server in same IDC) and deploys required services. For example, if php is enabled a week ago and they disabled it in text file. My perl program will make changes to those server immediately and disable php access for that domain.

    The next task is to put all those text config into pgsql and take action directly from browser instead of command line. So I'm deploying client server model (bot based) that take commands from central bot server and make changes to target UNIX box. All target box runs Debian. This may sound pretty complicated but with correct CPAN modules and good understanding of UNIX server programs one can deploy such solution in 4-6 weeks time including basic documentation.

    The real question is does your job asks for complex automation? If so than only you are going to use Perl / Python or Ruby. There is also a book called Perl for sys admin. It is a good starting point.

    HTH
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  8. The Following 2 Users Say Thank You to nixcraft For This Useful Post:

    jaysunn (27th March 2010), meta (29th March 2010)

  9. #6
    Senior Member monk's Avatar
    Join Date
    Jan 2005
    Location
    Tibet
    Posts
    643
    Thanks
    5
    Thanked 43 Times in 38 Posts
    Rep Power
    15

    Default

    Sooner or later, you will find yourself in a BASH environment, or on a box running UNIX different in each shell. Perl on the other hand remains consistent.

    Use bash / ksh for dirty and small scripts. /bin/sh is what all sys admin should use but these days everyone is so crazy about /bin/bash (especially Linux noobs). I advised /bin/sh for all start up scripts i.e. /etc/rcX.d stuff. In some case /usr will not be mounted in a single user mode and /bin/sh will work as in most case it is statically linked. Let face it porting shell scripts was a pain, but Perl scripts simply copied over and you are done. Go home.
    Last edited by monk; 27th March 2010 at 11:02 PM.
    May the force with you!

  10. #7
    Contributors jaysunn's Avatar
    Join Date
    Apr 2009
    Location
    NYC - USA
    Posts
    1,029
    Thanks
    165
    Thanked 154 Times in 133 Posts
    Rep Power
    24

    Default

    Holy Crap,

    So that's what you are up to. So to put things into perspective, you turn to perl to provide the scripting power/ support needed for your daily system admin needs.

    Thank you very much for taking the time to demonstrate / show what you are working on with the perl programming language.

    I have basically shell scripted everything at my work place to make things much easier, however I have really not been given a challenge to write perl. I always find myself wandering into the development department which primarily uses php to develop our CMS to see what they are up to. They always seem to be having more fun.

    I always get scared that I will automate myself out of a job. LOL

    When I started at my job everything was run from the command line. I have been using ruby / php to have a web based front end so that the average joe can use the web to run my shell / ruby scripts.


    Bottom Line.

    I love this stuff. So much. I eat , sleep and sh&t computers and code.

    Jaysunn

  11. #8
    Is that all you got? rockdalinux's Avatar
    Join Date
    May 2005
    Location
    Planet Vegeta
    Posts
    987
    Thanks
    27
    Thanked 71 Times in 62 Posts
    Rep Power
    20

    Default

    Personally, I use bash for simple shell commands, take this, mix it, do that and die, but, if it requires any logic beyond a couple simple loops and if statements, then you know it's time to switch to perl. I work with HP-UX (Bourne Shell), FreeBSD (csh), Solaris (KSH) and RHEL (Bash) and Perl is the only common thing between all of them.
    Rocky Jr.
    What's wrong? I hope I am not making you uncomfortable...

    Never send a boy to do a mans job.

  12. The Following 2 Users Say Thank You to rockdalinux For This Useful Post:

    kumarat9pm (27th March 2010), meta (29th March 2010)

  13. #9
    Senior Member
    Join Date
    Jun 2007
    Location
    Hyderabad, AP, India
    Posts
    806
    Thanks
    44
    Thanked 55 Times in 48 Posts
    Rep Power
    13

    Default

    Thanks for all valuable suggestions..

    Those make so much sense to me and learn perl/python for automating complex admin work..

    @Jay and Nix thanks for valuable suggetions

    As Jay said.. me too never feel the power of Perl and never got a chance to work on perl.. Many people used to say perl can do that one.. it can do this one etc..
    Thanks,
    Surendra Kumar Anne
    Linux: Fast, friendly, flexible and .... free!
    Support Open source.
    http://www.linuxnix.com

  14. #10
    Senior Member
    Join Date
    Sep 2006
    Posts
    131
    Thanks
    0
    Thanked 33 Times in 29 Posts
    Rep Power
    12

    Default

    after you learn Perl, learn Python. you won't look back.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. perl scripting
    By pansarevai in forum Coding in General
    Replies: 3
    Last Post: 7th May 2011, 05:20 AM
  2. Perl, python or awk
    By raj in forum Shell scripting
    Replies: 4
    Last Post: 20th February 2010, 11:05 AM
  3. Crontab and perl
    By sandeepvson in forum CentOS / RHEL / Fedora
    Replies: 11
    Last Post: 12th February 2010, 01:09 PM
  4. [Solved] I wanna know the name of right book which i refer to learn shell script
    By rayeesalam in forum Shell scripting
    Replies: 4
    Last Post: 26th January 2010, 11:42 AM
  5. few quick perl questions
    By raj in forum All about FreeBSD/OpenBSD/NetBSD
    Replies: 1
    Last Post: 30th June 2005, 12:27 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •