LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-20-2006, 04:15 AM   #31
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,276

Rep: Reputation: 170Reputation: 170

my go:

I program for a living.
Mostly small tools, filters, file parsing and reporting, XML
general purpose.


I reckon perl and python.
I have found:

perl is often faster than C if you put proper error checking and stuff for file opens in. But essentially the speed difference is minimal and easily outweighed by the power.

so i rarely use C (haven't since found perl) as i can knock up fifteen perl tools in the time to do one in C.

have started to learn python too and i think it's a beautiful language.
It seems more more maintainable; perl gets really ugly
with complex data structures (all lists are flat) and can
often be unreadable even by myself after a few weeks.
(and I am careful to make maintainable code)

practically, 99% of unix boxes have perl and most in my expereience don't have python.

so if you want a job...
 
Old 10-20-2006, 10:30 AM   #32
vargadanis
Member
 
Registered: Sep 2006
Posts: 248

Original Poster
Rep: Reputation: 30
If I want a job what? Sorry I don't get it... ^_^

I do not agree with you... I beleive that every code can be very well-organized and very massy too not depending on the programming language. I guess it depends on the programmer. I usually create a documentation for my works to find everything later if I have too.

What you told about the speed of perl is amazing. I knew that it is that fast but I did not know that this is that fast. ^_^
 
Old 10-20-2006, 10:36 AM   #33
vargadanis
Member
 
Registered: Sep 2006
Posts: 248

Original Poster
Rep: Reputation: 30
There is one more issue I would like to speak about... Some people beleives that perl is already a dead language, nobody uses it nowadays. Is it true? Do you thing that perl will ever disappear or sth. like this?
Do you thing that perl6 will be a huge change? I read a few thing about the parrot or how thay call it. What is the main difference bw. perl 5 and perl 6?
 
Old 10-22-2006, 11:32 AM   #34
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
If you want to learn a language with a bit of chest hair, check out LISP. It's a scripting language, but it can be translated into the assembly mnemonics through the COMPILE function.

Perl was the first language I ever learned, and I still use it from time to time for small tasks (converting all files in pwd of type a to type b). I've constantly been itching to learn C and/or C++ and everytime I finally muster up the courage to sit down and try to learn it, I just fall apart (usually when it comes to pointers). I thought my Perl knowledge would have helped, absolutely not. Over the years I've learned other languages like QBASIC, VB, Gambas, and Java. While three of those languages are BASIC derivatives, they're all extremely different from one another.

QBASIC/QuickBASIC, I love the language, the only problem is that it's dead. It's old, no longer supported by the company that implemented it (Microsoft), but still a fun and easy language (not object-oriented by any means, but then again, by definition, neither is C).

VB. Arguably the object-oriented evolved entity of QuickBASIC. The only was that it got tricky to do certain tasks in an efficient amount of LOC. And it incorporated GUIs, which was really nice.

Gambas is the Unicised version of VB. However, I find it to be less like BASIC, and more like some wierd hybrid between C, C++, Java, and BASIC (with more emphasis on C, C++ and Java).

As for Java, I have really mixed feelings about it. It's about as object-oriented as any language could get. Perhaps a bit too object-oriented; everything's an object. While I like it for creating console-based applications, graphical applications are a whole new world of drudgery and inane boredom...excuse me whilst I mop up the puddle of brains.

Over the years, too, I've grown tired of finding nothing but languages that are based off of other languages. I eventually looked at LISP, and it's rather odd - yet graceful - syntax intrigued me. I decided to give it a shot, and I've yet to be let down. Programs that would normally take me several hundred lines of declarations, functions and loop structures are done effortlessly and seamlessly in LISP. Yes, LISP is a REALLY old language, but there's a reason it's still around. The only precaution I feel the need to mention is it's syntax structuring: in C/C++/Java a variable declared once is forever, within that method, declared. Not true in LISP. Here's a comparison: defining a variable and referencing it each time through an infinite loop.
Code:
// Java
public class Test {
   public static void main(String[] args) {
      int i = 0; // i is defined here.
      int limit = Integer.parseInt(args[0]);
      boolean b = true;

      while (b == true) {
        System.out.println(i);
        i++; // it still exists here
        if (i > limit) break;
      }
  
      System.out.println(i); // and it still exists here
   }
}

----------------------------------------
;;; LISP 
(defun test-function (limit &rest values)
  (let ((i 0)) ; Here, i is defined.
    (loop
      (format t "~a~%" i)
      (incf i)
      (if (> i limit) (return))))
  (format t "~a~%" i)) ; Here, i isn't defined, and you'll get thrown an error.
LISP is a supremely fun language. I recommend giving it a shot. Like you, vargadanis, I've been caught up weighing languages against each other, but in the end, I just use LISP. Some things in LISP seem scarily easy, and that's because they are. All I can say is, if you decide to learn LISP, you're going to have to remap your logical pathways from the C way of thinking to the LISP way of thinking (the world makes a lot more sense for me now ).

If you decide you'll take a look at LISP, email me at nicksaika <at> gmail <dot> com, and I can send you a few eBooks I've found on LISP and detailed instructions on how to get set up with LISP.
 
Old 10-22-2006, 08:21 PM   #35
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,225

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Well, I used to use C years ago and liked it, but when I moved onto Perl it certainly made my life easier/quicker as a lot of the fiddly stuff in C is handled for you by Perl itself.
As for the speed qn, if you really want to know what's going on behind the scenes, take a look at this: http://www.perl.com/doc/FMTEYEWTK/comp-vs-interp.html
Personally, I really like having hashes as a basic data type in Perl. Anytime I want to represent a data structure (and this happens a lot), it means I can used named fields, instead of multi-dimensional arrays and having to remember what rec/field $arr[0][1][3] represents. Kind of self-documenting.
Also, of course, I can index straight into it when looking for an entry.
I can assure vargadanis that Perl is very much alive and heavily used, it's just not trendy like eg Java, PHP.
It's used a lot in the background by sysdamins and DBAs and data massaging programs.
Checkout http://www.perlmonks.com/ and search.cpan.org (pre-written perl modules to save you re-inventing the wheel).
Nonetheless, pick the lang that you think best suits the problem, unless it's dictated by where you work.
Keep in mind there's a limit to how many you can know well. (and your colleagues/successors).
 
Old 10-23-2006, 02:37 AM   #36
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,276

Rep: Reputation: 170Reputation: 170
agreed indienick, lisp is the language.
(also the second oldest language)

lisp gets bad press because you need a brain to use it.
there is no "lisp for dummies".

python has many lisp-like qualities which is why I like it;
including the fab interactive mode like lisp where you
can play about "live" as it were.

personally
C,perl,python,lisp


plus korn (not bash) shell.
 
Old 10-23-2006, 09:10 AM   #37
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
YES! Another Lisp enthusiast!
My dad read this post over my shoulder, and he's a huge KornShell fan.
My dad sends props, bigearsbilly.
 
Old 10-23-2006, 11:42 AM   #38
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: LFS-Version SVN-20091202, Arch 2009.08
Posts: 1,483

Rep: Reputation: 66
Does lisp compile into an executable binary or is it a scripting language like java and python.

or is it more like bash scripting ?
 
Old 10-24-2006, 03:46 AM   #39
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,276

Rep: Reputation: 170Reputation: 170
all the above depending on the implementation ;-)
I use clisp
which i usually compile to byte-code.
I think you can compile to binary but it's lots more work
defining types and stuff so it gets boring.
That is why i like lisp, not much effort for lots of result.
 
Old 10-24-2006, 09:35 AM   #40
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 110Reputation: 110
I like sbcl myself, it compiles into full ELF executable pretty easily. I'm actually trying to learn both lisp and Ruby in a useful way right now. What I've noticed is that Ruby is essentially lisp with M-expressions instead of S-expressions. Ruby just doesn't have the same level or orthogonality than lisp because of that.

Last edited by tuxdev; 10-24-2006 at 09:38 AM.
 
Old 10-24-2006, 10:03 AM   #41
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
chalk up another one for clisp.
 
Old 10-24-2006, 10:36 AM   #42
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 110Reputation: 110
Java as a language is really bad with code density. Also, doing the loop that way is really, really bad form. In C, a simpler functionally identical program is
Code:
#include <stdio.h>
int main(int argc, char **argv)
{
   int i = 0;
   int limit = atoi(argv[1]);
   puts("0");
   while(i++ < limit)printf("%d\n", i);
}
Unlike in Java, where things exist until the java GC gets around to cleaning things up, in C++, you can see exactly where an object is created and exactly where an object is destroyed. One of the really cool things about that is that the file objects will automatically close themselves at the end of scope, like
Code:
{  // create scope block
   std::ofstream file("foo");
   file << "bar";
}  // file automatically closed
Continuing on scope, the more correct way to write the Java version to act like the lisp version is to make sure you have all the right scope, like
Code:
// Java
public class Test {
   public static void main(String[] args) {
      {
      int i = 0; // i is defined here.
      int limit = Integer.parseInt(args[0]);
      boolean b = true;

      while (b == true) {
        System.out.println(i);
        i++; // it still exists here
        if (i > limit) break;
      }
      }
  
      System.out.println(i); // Compile error
   }
}

Last edited by tuxdev; 10-24-2006 at 10:38 AM.
 
Old 10-24-2006, 10:51 AM   #43
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
I want to learn perl or ruby or python but I do not know which one is the best.
It's a little like asking someone what their favorite film is, IMO. All a matter of opinion, because the three languages are comparable in many ways.

So here's my opinion, FWIW:
  • perl is ok, not great. Frequently tagged as a write-only, difficult to maintain language. Maybe that's not very fair. In any case, I don't care for it.
  • python is an easy to learn, easy to read (by virtue of compiler/checker-enforced whitespace), productive language.
  • ruby? Probably very similar to python, but I was introduced to python first so that is my preference.

Last edited by anomie; 10-24-2006 at 10:52 AM.
 
Old 10-25-2006, 03:46 AM   #44
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,276

Rep: Reputation: 170Reputation: 170
perl is a wonderful thing. you just need to persevere. It's really worth it.

when I first tried vi years ago i was a small boy using windows 3.11
and i hated and detested it with a deep and profound loathing.
I felt the same about perl when I first tried.

now i love them both and even invited them to my wedding
 
Old 10-25-2006, 09:57 AM   #45
Jack Deth
LQ Newbie
 
Registered: Oct 2006
Location: Toronto, ON Canada
Posts: 7

Rep: Reputation: 0
Hey there... Newbie here

I am partial to Perl since I have been working on and then with the WebAPP Network Team at web-app.net

Its where the WebAPP Perl Portal is developed... you guys should check it out...
It is a great script to play with to get you energized about perl... I see it all the time that phpers and other programming language users start messing around with the script and get into Perl big time...

of course the beauty there is then they contribute back and we end up with an even better portal script
 
  


Reply

Tags
language


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Python or Perl drdroid Programming 29 12-22-2006 09:54 AM
perl vs python yenonn Programming 6 08-01-2006 05:44 AM
Perl or Python JJX Programming 4 04-17-2006 02:42 PM
Python or Perl? Boby Programming 2 06-12-2005 10:54 AM
Perl or Python JJX Programming 6 10-27-2004 03:58 AM


All times are GMT -5. The time now is 08:02 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration