LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#1 March 3 2006

rolf
Member

Whaddya think about perl

I'm actually starting to program in Perl...
I stumbled across a funny blog entry that kind of sums my first impressions:

The first problem I had were the variable sigils: $ @ %... what the hell were those? Why do they need to jumble up my source code? They don't add to readability? Line noise... line noise! And, why the hell is it @array but its $array[1]? And... and... what the hell is:

@a=(foo,bar,baz,quux,psqs,mind);
%b=@a;
print $b{baz};    # prints "quux"
print @b{@a};     # prints "barquuxmind"

An @-thingy is constructed and then assigned to a %-thingy, and then you use a $-thingy in front of what once was a %-thingy with {baz} after it and that prints out the element in the original array that came right after baz, quux,... buuuuuut, if you use two @-thingies, one inside the curly braces and one that just happens to have been assigned into the %-thingy in the first place, i.e. @b{@a}, it prints every other element from the original @a?!?! This is maddening! Why would anyone, *anyone*, in their right mind use this slightly-less-terse-brainfuck of a language??

Here's the complete post:
http://www.alpha-geek.com/2004/09/08/perl

I'm still learning it, I like regular expressions in perl, although I sometimes get confused when I see regex without quotes... yet it's a giant leap from PHP where you need to write 5 lines and spend 15 minutes of debugging and scratching your head to make sure that the right submatches are going into the right arrays, and even then you'll still have doubts.

There are a lot of other bright aspects... like the speed, and the incredibly huge variety of modules... I thought you could do a lot with PHP, but wait until you see Perl... :)

Anyway anyone else here knows perl?

Offline

#2 March 3 2006

rolf
Member

Re: Whaddya think about perl

There's even a module to run PHP from perl and btw there's also a PHP module to run and control Perl code from PHP, and I'm using it right now.
And by the way unicode support in perl is really great.
You can have both normal and unicode variables or streams in the same script, and regular expressions, functions, etc... will automatically detect the encoding of the variable or stream and act accordingly. Heck you can even write the whole source in unicode if you want. That again is light years of PHP where working with unicode is a pain.

Last edited by rolf (March 3 2006)

Offline

#3 March 4 2006

samer
Admin

Re: Whaddya think about perl

what a coincidence :) I installed activePerl on my windows box yesterday. Hopefully to start experimenting with the language.

Offline

#4 March 4 2006

rolf
Member

Re: Whaddya think about perl

Check the documentation in c:\perl\html

Offline

#5 March 5 2006

rolf
Member

Re: Whaddya think about perl

Perl beats PHP all the way but it's harder to learn, and big perl programs can somehow upset your stomach just by looking at the crazy syntax.

Offline

#6 March 5 2006

teodorgeorgiev
Member

Re: Whaddya think about perl

Rolf,

Perl is not that hard to read (unless reading regexes, this drives me crazy), depends on the programming style of the individual (the programmer). If you write a nice commented and readable code in C, you will do the same in Python, Perl and Pascal...

I am very addicted to Perl, but I have to admit that as far as for web enabled applications (web interfaces) PHP is easy to write in, that Perl. And in general - yes, PHP is much easier to learn than Perl.

And for writing system administration scripts, Perl rocks...

Offline

#7 March 5 2006

darkstar
Member

Re: Whaddya think about perl

I was reading about it a while ago. As teodor said its really good when it comes to system admin. scripts

Offline

#8 March 5 2006

rolf
Member

Re: Whaddya think about perl

teodorgeorgiev wrote:

I am very addicted to Perl, but I have to admit that as far as for web enabled applications (web interfaces) PHP is easy to write in, that Perl. And in general - yes, PHP is much easier to learn than Perl.

PHP is great when you want to quickly develop a dynamic part of a webpage, just take the html page and add some php code, it cannot be any faster and easyer. But for large and complex projects ESPECIALLY if there is a lot of data processing and interacting with external programs, then perl beats php.

So far I have noticed that:
-Perl is MUCH more efficient then PHP for data processing, i'm talking double the memory usage and speed or more.
-Perl has a lot more modules to interact with other parts of the computer, and those are more stable and easyer to use.
-As I said before it has a great unicode support.

Now the application I am developping is not a web application but a data processing and linguistic application, and Perl was actually created specifically for this task, so I'ts not really fair.

Offline

#9 March 6 2006

mir
Member

Re: Whaddya think about perl

Good Luck with those @ %$ stuff
u will get used to them lool

i donno a word of Perl
but since there are good feedback, i will consider learning it of course.

Offline

#10 March 6 2006

teodorgeorgiev
Member

Re: Whaddya think about perl

Hi Rolf,

need a helping hand on Perl - drop me a line :)

The only "bad" thing with Perl is when writing commercial software. You can not put a good copy protection, because it is a scripting interpreating language, not a compiled one. There are some workarounds for this, though. You can convert Perl to C code, or for Windows ro use the application Perl2exe (which is paid).

And btw, good programmers will always avoid languages like Python and Java. I know that it is very easy to "program" in these, but may God help to these using such applications. At least they consume damn much memory.

Offline

#11 March 6 2006

rolf
Member

Re: Whaddya think about perl

Thanks :)

Offline

Board footer