Jump to content

Perl or Shell?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
14 replies to this topic

#1
Hektor

Hektor

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
Which should I learn, Perl or Shell scripting for Linux? I know Perl a little and have used it in the past so I have that to my advantage. Shell Scripting is new for me though but seems fairly easy and kinda neat.

What do you suggest?

#2
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
Personally, I prefer shell scripting (with sh) But I can't really recommend it over the other, as I've no experience with Perl at all. I think you should try out both of them for some time, and then decide which of them to use.

#3
Guest_Jordan_*

Guest_Jordan_*
  • Guests
I recommend shell scripting as well. Perl is a dying language IMO.

#4
Hektor

Hektor

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
Isn't Perl still used a lot on Linux/Unix systems tho?

#5
EGS

EGS

    Programmer

  • Members
  • PipPipPipPip
  • 116 posts
How can you use perl with Linux?
Executing shell commands seems to be the most popular way with Linux from what I have seen. :)

#6
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
To use Perl on Linux, you can normally just type perl in the terminal. Either alone or followed by the name of the Perl-script to run. If no name is given, you can use it as a simple interpreter.
$ perl
print "1+2=", 1+2, "\n"
1+2=3
When you've written the print-statement you'll have to interpret it, which is done by pressing CTRL+D, and then the result will show up.

#7
Guest_Jordan_*

Guest_Jordan_*
  • Guests
If you have your shebang correct:

#!/usr/bin/perl

at the top of your Perl script you can execute it like you would a shell script. IE:

# ./myPerlScript.pl


#8
EGS

EGS

    Programmer

  • Members
  • PipPipPipPip
  • 116 posts

v0id said:

To use Perl on Linux, you can normally just type perl in the terminal. Either alone or followed by the name of the Perl-script to run. If no name is given, you can use it as a simple interpreter.
$ perl
print "1+2=", 1+2, "\n"
1+2=3
When you've written the print-statement you'll have to interpret it, which is done by pressing CTRL+D, and then the result will show up.
I would definitely think Shell and SSH would be easier to execute commands, then. Perl is a programming language, is it not? You'll basically be programming commands sort-of-say with Perl... :eek: Much more difficult, no?

#9
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
Wait. You wouldn't use Perl like that! That would only be for testing, etc. You'll put it in a file, which you could execute much easier, and it would be much easier to use. So it wouldn't be really hard.

#10
Hektor

Hektor

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
So the consensus seems to be Perl = Bad?

#11
MHJ

MHJ

    Newbie

  • Members
  • PipPip
  • 29 posts
Maybe not so much bad as much as "less optimum" of a choice. It has its positives and negatives

#12
LissaValerian

LissaValerian

    Learning Programmer

  • Members
  • PipPipPip
  • 53 posts
I would have to disagree with most of the sentiment here. I use both perl and shell for my scripting. PERL can be very powerful if you know how to use it. I've worked for a major multimedia news company and I can tell you that A LOT of their behind the scenes stuff is written in PERL. I hardly think it is a dying language.

I think that both are good/handy to learn and it's valuable to know both. When you know both, you'll know which is better in what particular situation.

Perl Rules!