Go Back   Linux Forums by TotalPenguin! Get linux Help! > GUI Linux > Linux Programming and Scripting

Linux Programming and Scripting Discussion for Linux Programming and scripting (including Perl, PHP, C, C++, and other languages)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-25-2008, 10:19 PM
Member
 
Join Date: Jan 2007
Posts: 94
Hektor is on a distinguished road
Default Perl or Shell?

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?
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 03-26-2008, 05:31 AM
Super Moderator
 
Join Date: Dec 2007
Location: Denmark
Posts: 273
v0id is on a distinguished road
Send a message via MSN to v0id
Default

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.
Reply With Quote
  #3 (permalink)  
Old 03-26-2008, 11:34 AM
Jordan's Avatar
Administrator
 
Join Date: Nov 2006
Posts: 468
Jordan is on a distinguished road
Default

I recommend shell scripting as well. Perl is a dying language IMO.
Reply With Quote
  #4 (permalink)  
Old 03-26-2008, 05:21 PM
Member
 
Join Date: Jan 2007
Posts: 94
Hektor is on a distinguished road
Default

Isn't Perl still used a lot on Linux/Unix systems tho?
Reply With Quote
  #5 (permalink)  
Old 03-29-2008, 08:19 AM
Senior Member
 
Join Date: Feb 2008
Posts: 106
Justice M will become famous soon enough
Default

How can you use perl with Linux?
Executing shell commands seems to be the most popular way with Linux from what I have seen.
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 03-29-2008, 09:23 AM
Super Moderator
 
Join Date: Dec 2007
Location: Denmark
Posts: 273
v0id is on a distinguished road
Send a message via MSN to v0id
Default

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.
Code:
$ 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.
Reply With Quote
  #7 (permalink)  
Old 03-29-2008, 04:35 PM
Jordan's Avatar
Administrator
 
Join Date: Nov 2006
Posts: 468
Jordan is on a distinguished road
Default

If you have your shebang correct:

Code:
#!/usr/bin/perl
at the top of your Perl script you can execute it like you would a shell script. IE:

Code:
# ./myPerlScript.pl
Reply With Quote
  #8 (permalink)  
Old 03-30-2008, 01:47 AM
Senior Member
 
Join Date: Feb 2008
Posts: 106
Justice M will become famous soon enough
Default

Quote:
Originally Posted by v0id View Post
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.
Code:
$ 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... Much more difficult, no?
Reply With Quote
  #9 (permalink)  
Old 03-30-2008, 07:31 AM
Super Moderator
 
Join Date: Dec 2007
Location: Denmark
Posts: 273
v0id is on a distinguished road
Send a message via MSN to v0id
Default

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.
Reply With Quote
  #10 (permalink)  
Old 04-04-2008, 01:22 AM
Member
 
Join Date: Jan 2007
Posts: 94
Hektor is on a distinguished road
Default

So the consensus seems to be Perl = Bad?
Reply With Quote

Sponsored Links
Reply

Tags
perl, script, shell scripting

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"edit" in Shell Lop Linux General 3 10-10-2007 01:35 AM


All times are GMT. The time now is 09:08 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.