LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Python/Perl Command Equivalents (https://www.linuxquestions.org/questions/programming-9/python-perl-command-equivalents-898357/)

ghostdog74 08-21-2011 08:34 PM

Quote:

Originally Posted by Sergei Steshenko (Post 4449415)
Oh, really ?! How about:


http://docs.python.org/library/array.html :

In Perl arrays are built-in, come with language, not with a module.


If you are too forgetful, let me bring you back in time to what you said:
Quote:

Originally Posted by Sergei Steshenko
Seriously, I reject Python first and foremost for lack of lexical scoping. And for lack of arrays. And for whitespaces being used to denote code blocks - and I do indent in Perl/"C".

You said "lack of arrays" is one of the reasons you reject Python. But arrays are supported in Python, both as built in lists (1D) , and a thin wrapper module (array) around C arrays. You did not specifically mention that you reject Python because it doesn't come built in like that in Perl. And you quickly change your argument in this post. And, if people finds it easier to maintain and read, then its their business. You have no reason to sound arrogant and insult their intelligence. Not sure what I am talking about? See post #20

ghostdog74 08-21-2011 08:49 PM

Quote:

Originally Posted by Woodsman (Post 4449367)
Thanks everybody for the responses. I get the big picture that at least for Perl and Python, there are ways to perform the same tasks that are performed in shell scripts.

Perl and Python are not the only ones. There's also Ruby.

pafoo 08-22-2011 09:31 PM

Let me tell you one piece of advice. I am a Linux Sys Admin and I used to only shell script. Me and another guy I went in took it upon ourselves to "step our game up." Him with perl, me with python. Let me tell you what, within 1 month, both of us were making "scripts" that out performed a shell script by far. Think on, combining awk,sed and bash together with phenomenal error handling and full lists and dictionaries with direct access to shell commands and there results similar to $?. MUCH more readable code (python, not Perl), with the availability of an entire test sweet "IDLE" to test all lines of code as you develop it. You cant go wrong!!! By the way, I stomped ol' perl boy as he continually tried to find "There's more than one way to do it..."

Because of it I have received praise on the error handling and power of Python's simplicity over Perl/ksh/bash/awk/sed scripting!

BTW im not saying use python. Perl is a awesome and powerful language to replace shell scripting with. Anything "upper" language is better than old school shell scripting.

j-ray 08-23-2011 01:24 AM

Quote:

Perl and Python are not the only ones. There's also Ruby.
...or PHP

I'd like to mention that any programmer can write perl code that is readable for C-, Java-, PHP-programmers without much difficulties.

ghostdog74 08-23-2011 02:31 AM

Quote:

Originally Posted by j-ray (Post 4450823)
...or PHP

why do you even suggest that? PHP is a bloat, too many similar functions, no namespaces (until recently? ) ... and whole lot more problems..

j-ray 08-23-2011 02:49 AM

Quote:

why do you even suggest that?
I know it has some disadvantages but some colleagues like it for command line jobs as well as for web stuff.

Anyway I'm making money with it so I liked to mention it as an option. Some people don't know it can be used from command line.

Proud 08-23-2011 05:21 AM

PHP Hypertext Preprocessor.
Does what it says on the tin. Hardly with a good history, and not for anything else.


All times are GMT -5. The time now is 04:13 PM.