?

Log in

No account? Create an account

Previous Entry | Next Entry

Data structures and algorithms in Perl

Opinions on Perl as a language for learning data structures and algorithms?

(I'm not seriously suggesting it, I just want to hear pros and cons.)

--
Banazir

Comments

( 9 comments — Leave a comment )
yahvah
Sep. 29th, 2004 08:19 am (UTC)
Hmm. I think Perl data structures rock. I believe they're easier to create and maintain than data structures in C, but then again that requires familiarity with Perl's syntax. Don't they call it syntactic sugar? The biggest hurdle with Perl is picking up all of its syntactic sugar, I think.
zaimoni
Sep. 29th, 2004 08:24 am (UTC)
I'm mostly familiar with algorithms texts based on third-generation languages (C/C++).

Perl is awesome for quick implementations, but its gross lack of compile-time and runtime error-checking is my single biggest frustration with it.

I can't think of a better language for showcasing hash-based algorithms, although not hashes themselves.
(Deleted comment)
banazir
Sep. 29th, 2004 10:30 am (UTC)
I never knew you programmed!
Are you a abductdee from Digitopolis from when 3p lead the longboat party? Or are you actually Reason in disguise? :-D

Python is, from what I can tell, every bit as much a scripting language as Perl is. Please do tell: why do you feel that Perl is any more fear-inspiring?

My students are pushing PHP these days, and I'm leaning the JSP/ASP .NET way.

crypthanatopsis, feel free to jump in any time, and sell Rubies even.

--
Banazir
zaimoni
Sep. 29th, 2004 06:34 pm (UTC)
Re: I never knew you programmed!
Python rules if you need fast, memory-efficient text processing. (I have a few Python scripts in my path for such emergencies as needing to get at lines 123,456-423,167 of a one-million-line text file. MyPHPAdmin SQL total DB backups get larger than that.) But the language spec is too mutable to be relied on in a cross-version environment. Pity, since it's easy for C to be slower than Python in text-processing tasks.

Perl and Python are syntactically close enough that they destructively interfere: programming in one will temporarily impair skills in the other.
sze
Sep. 29th, 2004 08:29 am (UTC)
the only problem i have with perl is how convoluted the syntax can be..i like what yahvah says.. "syntactic sugar" hehe... perl can be overcomplicated for the wrong reasons. but its a wonderful parsing language.
myng_rabbyt
Sep. 29th, 2004 10:33 am (UTC)
can be overcomplicated for the wrong reasons
*vigorous nod* I'd like to think I can understand languages and their purposes, even if I can't utilize them. But when I think of Perl, it, as cavlec put it, "scares the crap out of me."

I have a friend who created a tutorial for it; when I try to read it to understand Perl, I cry and run away.
penguinicity
Sep. 29th, 2004 09:05 am (UTC)
Ugh. I'm not a fan of Perl as a language for learning anything (and I use Perl on a regular basis in my day to day work). TMTOWTDI is great for putting something together quickly, but gives the beginner too many opportunities for confusion.

As for data structures in particular, Perl's objects have always felt like a hack to me - there's too much "magic" that goes into making something an object and it seems like it would be intimidating for a beginner.
idigital
Sep. 29th, 2004 03:08 pm (UTC)
I'll preface this by saying I've got several years intensive Perl experience, so I'm almost certain to be biased.

For data structures, Perl is very powerful. Check XML::Simple out, as a basic example of how things can be set up. You can even dump out entire data structures into a string with things like FreezeThaw (you could then save that string into a file or mysql DB or something)

The only major downside with Perl is its speed, especially with high-end numbercrunching. It's an interpreted language, so, unlike C which is already compiled prior to execution, the Perl compiler has to compile it at execution time, which can slow things down (although not noticeably for most things).

I've got only a few days' worth of experience with C, so I can't really compare the two languages, although most of the syntactic sugar is similar between the two languages, as Perl was made to be C-like.
( 9 comments — Leave a comment )

Latest Month

December 2008
S M T W T F S
 123456
78910111213
14151617181920
21222324252627
28293031   

KSU Genetic and Evolutionary Computation (GEC) Lab

Teunciness

Breakfast

Science, Technology, Engineering, Math (STEM) Communities

Fresh Pages

Tags

Powered by LiveJournal.com
Designed by Naoto Kishi