Sponsored Content
Full Discussion: perl limitations vs. bash?
Top Forums Shell Programming and Scripting perl limitations vs. bash? Post 302421490 by jlliagre on Friday 14th of May 2010 11:42:55 AM
Old 05-14-2010
Okay, so let me explain my position again:
Quote:
Originally Posted by unclecameron
I've building a bunch of bash scripts, and am thinking about "converting" to perl
Why do you want to convert these scripts in the first place. Performance ? Reliability ? Portability ? Curiosity ? Fun ?
Quote:
and have a couple questions first:
1. Is there anything bash will do that perl won't?
Bash like ksh93 which I prefer and other shells are scripting languages which can be used both interactively and not. (Bourne) Shell syntax has been defined several decades ago and is doing well. Knowing it is kind of something mandatory when you work with Unix. Shells features have increased within the years but shells are still following the Unix philosophy where specialized programs using stdin/stdout/stderr and error codes are used to build complex tasks, instead of having a one fit all approach.
Perl on the other hand isn't designed to be used interactively and certainly cannot be used as a login shell (of course you can use a program written in any language including perl as your login shell, but that's off topic. plsh is written in perl but isn't perl itself). Perl was initially designed to be an improvement over sed and awk which is fine. IMHO, it has derailed when becoming a general purpose programming language.
Unlike shells which leverage them, Perl doesn't encourage to reuse available external utilities. Everything is simpler when using a dedicated perl library explaining the large span of perl modules available. This is an advantage when running in a Unix hostile environment like Windows but I don't see the point in building such a self-centric ecosystem on Unix / Gnu/Linux.
Compared to competing general purpose languages, perl is pretty famous for its cryptic syntax. Someone with a little background with programming languages can read and understand code written in other programming language he doesn't know with very little learning or even not at all. Perl is a big exception. It has many unique idioms you cannot guess or easily find in its documentation. While this might not be an issue for code you write and maintain yourself, this can prove disastrous for code that need to be updated by someone else while the original author is no more available years after that. Almost anyone can pick an old sysadmin or whatever shell script and adapt it to suit new needs. With perl, unless the code has been carefully written and commented to avoid that risk, the more productive way might be to rewrite the whole from scratch when nobody is able to understand it. That's what I meant with negative productivity, I wasn't referring to performance which is a different point. If you really demand performance, just use C for the critical parts. If you want cross platform portability, I would strongly prefer Java which is much more readable and has an even larger community and industry support.

To summarize, I see perl as an addictive/elitist language which doesn't that much worth converting existing scripts to. On the other hand, like most languages, it can be useful and efficient for some specific tasks and might still be a good choice for simple scripts called from the shell.

By the way, I'm not a mod here.
This User Gave Thanks to jlliagre For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

mkdir limitations

What characters can't be used with a mkdir? Any limits on length of name? Thank you, Randy M. Zeitman http://www.StoneRoseDesign.com (12 Replies)
Discussion started by: flignar
12 Replies

2. UNIX for Dummies Questions & Answers

Unix Sort - Limitations

Hi All, I want to sort a flat file which will contain millions of records based on a key/field. For this I want to use unix sort command and before that I want to make sure that unix sort command has any file size limitations. And also please let me know whether I have to change any... (2 Replies)
Discussion started by: chprvkmr
2 Replies

3. AIX

SORT Command Limitations

Hi every body, On AIX 4.3.3 what is the maximum file size that can be used with sort command? (0 Replies)
Discussion started by: aldowsary
0 Replies

4. UNIX for Dummies Questions & Answers

csplit limitations

I am trying to use the csplit file on a file that contains records that have more than 2048 characters on a line. The resultant split file seems to ignore the rest of the line and I lose the data. Is there any way that csplit can handle record lengths greater than 2048? Thanks (0 Replies)
Discussion started by: ravagga
0 Replies

5. UNIX for Dummies Questions & Answers

Password limitations.

I would like to set my minimum password length to on Linux and AIX. However, doing this normally would only make it so newly added users will be affected by this. I would like for when I make this change, it either truncates everyone elses password, or prompts them to change it to 8+ characters.... (2 Replies)
Discussion started by: syndex
2 Replies

6. Shell Programming and Scripting

passing variable from bash to perl from bash script

Hi All, I need to pass a variable to perl script from bash script, where in perl i am using if condition. Here is the cmd what i am using in perl FROM_DATE="06/05/2008" TO_DATE="07/05/2008" "perl -ne ' print if ( $_ >="$FROM_DATE" && $_ <= "$TO_DATE" ) ' filename" filename has... (10 Replies)
Discussion started by: arsidh
10 Replies

7. UNIX and Linux Applications

gnuplot limitations

I'm running a simulation (programmed in C) which makes calls to gnuplot periodically to plot data I have stored. First I open a pipe to gnuplot and set it to multiplot: FILE * pipe = popen("gnuplot", "w"); fprintf(pipe, "set multiplot\n"); fflush(pipe); (this pipe stays open until the... (0 Replies)
Discussion started by: sedavidw
0 Replies

8. Red Hat

Eth0 Limitations

Hi, I have noticed some performance issues on my RHEL5 server but the memory and CPU utilization on the box is fine. I have a 1G full duplexed eth0 card and I am suspicious that this may be causing the problem. My eth0 settings are as follows: Settings for eth0: Supported ports: ... (12 Replies)
Discussion started by: Duffs22
12 Replies

9. Solaris

Solaris limitations

Hi, I recently started working with Solaris, and what I noticed is that a lot of commands I used to regularly use don't work, like sed -i and grep -r. I have found work arounds for these problems though but it's a pain in the ass. I'm just wondering why they decided not to include these handy... (4 Replies)
Discussion started by: Subbeh
4 Replies

10. Linux

Linux partitions and limitations

In recently reading an article on linux basics before I embark and my personal installation project I came across this passage - IDE drives have three types of partition: primary, logical, and extended. The partition table is located in the master boot record (MBR) of a disk. The MBR is the... (12 Replies)
Discussion started by: Synchlavier
12 Replies
All times are GMT -4. The time now is 02:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy