Mastering Algorithms with Perl
Mastering Algorithms with Perl is designed to provide the necessary background. It's structured like a traditional algorithms textbook: after describing some basic and advanced data structures (linked lists, trees, heaps, etc.), it has chapters about searching, sorting, sets, matrices, graphs, strings, and some related topics. After the introduction and discussion of data structures, the chapters are relatively independent and could be read in any order. The authors provide plenty of cross-references as well as pointers to books that describe individual subjects in more detail.
The intended audience is programmers who don't have a background in computer science, who know at least some Perl. However, experienced programmers who don't know Perl should have no trouble picking up the basics of the language with this book and a copy of Programming Perl. Also, computer scientists can often use a review of algorithms, and the CPAN pointers are very useful. So, I would go so far as to say that this book would enrich any programmer's bookshelf. A stringent test of the merit of a new technical book is to ask if it adds some value, given the best existing books in its area? I think that Mastering Algorithms with Perl definitely does. It is a well-written introduction to algorithms that is more accessible, practical, and entertaining than standard algorithm books. It leverages off of the strengths of a powerful language and a large base of reusable code.
The rest of this review will evaluate the strengths and weaknesses of Mastering Algorithms with Perl in more depth. The central issue that I will consider is why the reader might or might not prefer an algorithms book that concentrates on a single language, as opposed to a general algorithms book. I will try to be up-front about my biases: as a computer scientist, I consider this book to be a compromise between an algorithms book and a how-to manual. This compromise makes it much more useful to Perl programmers, but it sometimes causes the algorithms content to be too watered down.
It is traditional in algorithms books to describe algorithms in pseudocode, which often superficially resembles Pascal. The difference between pseudocode and real code is that pseudocode is not compilable - it ignores implementation details that are not helpful to understanding a particular example. This is considered to be an advantage: without the clutter, the core of the algorithm is easier to see and understand. At the beginning of the book the authors make the point that the Perl code for a binary search is actually shorter than the corresponding pseudocode. And it's true! The advantage of the Perl program is that we have a readable description of the algorithm, and it's executable too. (Unfortunately, it's often nontrivial to convert pseudocode into real source code - the devil is in the details.) The binary search example is slightly misleading, however, because in this case a native Perl data structure (the array) matches the semantics of the problem extremely well, leading to a clear and concise implementation. Later in the book, particularly in the chapter on graphs, we see examples where Perl's built-in data structures are less well suited to the problems. The executable Perl code for graph operations are much longer than the corresponding pseudocode, and are often so syntactically cluttered that they are difficult to read. Is this a flaw in the book or in Perl? No - it's a consequence of giving examples in runnable code instead of pseudocode. Is the tradeoff worth it? Probably, but it depends on what you're trying to get out of the book.
Another consequence of basing an algorithms book on a real language is that the authors can point readers to existing implementations of the algorithms, in CPAN. It's hard to overstate how big of a win this is. Perl is a powerful language to begin with, but it becomes far more powerful when programmers are able to take advantage of the large body of existing code modules. An unfortunate side effect of the fact that the book talks about specific versions of Perl and about specific CPAN packages is that this information will become outdated much more quickly than the algorithms will. Unless the Perl language and CPAN are exceptionally stable in the future, I would not expect most of this information to be valid for more than a few years - hopefully a new version of the book will be available before this one becomes too out of date.
Because the book provides executable code for the algorithms, it's possible to evaluate the performance of the example code (which is available at the O'Reilly site). The authors benchmark a number of the algorithms that they present, and compare the results. This is a nice change from the discussion of asymptotic running times found in traditional algorithm books, which generally ignore the constant factors that often make the difference between an algorithm being useful in practice or not.
The design and analysis of algorithms is a highly mathematical discipline. A sophisticated set of tools has been developed to evaluate the tradeoffs between various algorithms: How efficiently do they use memory and processor cycles? What is the best, average, and worst case running time of various operations? How does the algorithm scale as the size of the input grows? As it turns out, programmers need to understand a few of these formalisms, particularly the "big O" notation for describing asymptotic running time. I think that Mastering Algorithms with Perl uses theory in just the right way: as an aid to programmers' intuition about algorithms, rather than beating us over the head with formulae and proofs. That said, I think there is one area of theory that this book should have spent more time on: NP completeness. NP-complete problems are solvable, but are believed to be inherently hard: no efficient algorithm has been discovered to solve them. There are a wide variety of NP-complete problems, and they do come up in practice. For programmers, the important thing is first to recognize that an NP-complete problem has been encountered, and that it cannot be solved exactly except in small instances. Then, a heuristic that comes up with a good enough approximation of the solution needs to be found and implemented. This is a practical and well-studied part of algorithm design, and in a 650-page book I would expect more than a page or two to be devoted to it.
Several chapters of Mastering Algorithms with Perl are too shallow to be considered good introductions to the associated areas of algorithms. For example, the chapter on matrices only shows code for some of the more trivial matrix operations; for complex tasks, it tells the reader how to use PDL - the Perl Data Language. Although PDL looks like a useful and powerful package, readers should not confuse knowing how to use it with understanding matrix algorithms. In other words, the matrix chapter is too much of a how-to manual. Other chapters such as the ones on searching and sorting are excellent and avoid falling into this trap. Algorithms is a huge area, and it can't all be covered well in 650 pages. The later chapters are a lot of fun to read, but some of them should probably have been scrapped in favor of more depth in core areas.
In conclusion, this is a well-written, useful book. Viewed as a Perl book it's superb; it complements the strengths of Programming Perl and The Perl Cookbook, and I think most or all Perl programmers would benefit from having a copy. Viewed as a computer science book, it has made a number of compromises in order to focus on a specific language; this is not necessarily a problem but it is something that readers should be aware of.
Acknowledgments: Thanks to Tom Christiansen, Dave Coppit, Bill Pearson, and Jamie Raymond for helpful comments on previous drafts of this review.
Purchase this book at fatbrain.
This looks like the perfect gift for that PERL nut in your life for X-Mas ;)
--
Sinepaw.org: Grape Winos
So if we don't know Perl, or any other language (yet) then we're screwed in reading it?
Argh. Can anybody recommend a good basic book for those of us not from a Computer Science background (my degree is in theatre) but who are trying to get into programming, albiet slowly?
Listen to me Peter, I want this bench. You go sit on that bench over there, and if you're good I'll tell you the rest of
Agreed - I know the fundamentals of things like VBScript and have used Visual Basic and C++ and Pascal (yes really!) to a limited extent. Anyone got any pointers for any good online resources for learning things like CGI and Perl?
If you are looking to get into programming, perhaps you should look into "Learning Perl" by OReilly, it's the llama book. I would say that Perl is sufficiently easy as a beginning language.
The intended audience is programmers who don't have a background in
computer science, who know at least some Perl. However, experienced
programmers who don't know Perl should have no trouble picking up the
basics of the language with this book and a copy of Programming Perl.
sorry, i just had to post the summary the way it was ment to be, with the \n instead of WordsStuckTogether (words stuck together). I have that compulsive disorder and I was going nuts,you can moderate this down.
First, I'd like to say that this book is probably *not* for the beginner (as in, read one of the other Perl books first, and write in it for a while, I still have to read Learning Perl sometime...)
:)
Second, I'd like to ask why a good, pseudo-code, readable language *isn't* more popular nowadays. There are many books written like this (my Operating Systems text in school, and many of the examples, are written in something that looks like Pascal with support for multiple processes, although I've never seen such a beast) and their code is very readable.
I used to write in Turbo Pascal 7, and I enjoyed writing classes ("objects") with it. All my code was inherently pretty readable, even when I used nasty tricks, unlike my C code (or most Perl code that I've seen). Later, I did convert some of it to C and C++ with p2c and some hacking on my own, but it would be nice to maintain the readable version of the code.
---
pb Reply or e-mail rather than vaguely moderate.
pb Reply or e-mail; don't vaguely moderate.
Learning Perl by O'Reilly. Or you could make the mistake I did, and buy Programming Perl instead. Of course, the O'Reilly books are so clear, it helped me quite a bit.
I don't really have any programming background, just batch files and shell scripts. The best thing I have found to do is find a piece of code, play with it, and look up what you don't understand.
Guess I have to add yet another O'Reilly book to the collection...
provides very little that you can't get in a basic data structures class. I finished the entire book at a swim meet one day because there really wasn't anything that revolutionary behind it. Aside from pseudo-hashes, which look pretty nifty, I don't see much value in investing in this book if you already know data structures/sorting algorithms. I suppose if you didn't have a basis in those it would be a wise investment but even then most of the concepts are fairly simple and fairly intuative. My advice would be to buy an office copy and keep it around as a reference for your programmers if they have a brain freeze, but don't bother with a personal copy. .agrippa.
I would recommend Learning Perl also by O'Reilly & Associates. When I first started learning Perl, this book was invaluable. Perl was also, for me anyway, a good first programming language to learn on. Prior to that, the only other language I had learned was BASIC, and only very little. Most people will recommend not starting with a language like C, due to its complexity. Perl seems to be a good starter.
I now use Programming Perl and Perl Cookbook. Both are from O'Reilly & Associates. This book also sounds like a good reference to have once you have the basics down.
Ryan
P.S. My major was also theater (design).
I have this book and have skimmed through it. This is basically computer science algorithms (zillion of different sorts, graph representation, etc.) implemented in Perl. The problem is that this book has limited relevance to real life. "Perl Cookbook" is much, much more useful in this regard.
So, if you are collecting all Perl book, or are really interested in how to implement red-black trees in Perl, do buy it. On the other hand, if you are looking for snippets of code to solve small-to-medium-sized problems you meet all the time, "Perl Cookbook" is a much better choice.
Kaa
Kaa
Kaa's Law: In any sufficiently large group of people most are idiots.
I've seen some suggestions for "Learning Perl" here, and I'd agree. But you might also want to think about "Learning Python", also from O'Reilly.
This is straying onto religious war territory, but Python's possibly an "easier" language to learn than Perl for a newcomer to programming, and it's certainly as powerful (and anyway, they have a lot in common).
Hope This Helps,
Andy
http://www.gimbo.org.uk/
Can anybody recommend a good basic book for those of us not from a Computer Science background (my degree is in theatre) but who are trying to get into programming, albiet slowly?
You don't necessarily need a book. Although I like having a peice of paper to reference (call me old-fashioned), there are many resources you can access for free on the internet (and print out if you're like me). Just hop over to http://www.google.com and enter the words "Perl Tutorial" for lots of good links.
When will Windows be ready for the desktop?
"it ignores the very interchangeability of languages at the heart of such things as the open- source movement"
Errr.. ?
I think you are missing the point. There are plenty of books on Algorithms. Loads. Really, lots and lots and lots. However, until now there were few that focussed on Perl.
Some consider Perl to have outgrown its old 'Unix scripting language' roots, and so a book that looks at a strong foundation of programming principles for Perl is welcome.
If this book is shelved with 'Algorithms' then it has been misshelved, I'll grant you. If it is shelved with 'Perl' then it is a very useful contribution.
I don't think the author's were trying to promote greater understanding of algorithms and forcing people to learn Perl while they did it.
-----
I would disagree that perl is a good beginners language. It has way to many hacks and gimmics in it. (This is not always a bad thing. Just that it lets beginners get away with too many things. At one point I inherited some horrid perl code that a decent grounding in CS would have helped immeasurably.) I'd suggest a cleaner, strongly typed language like python or java. Both have active development groups, and there's lots of documentation and examples out there. And ORA has books for both languages.
Zapman
I think you've hit the nail on the head.
Perl has been unusual in being a language that started in a small niche were it was used by non-computer-science folk (Unix sysadmin), moved into ANOTHER niche of the same kind (simple CGI), and is now widening its usage into a general applications programming language.
That's why these kinds of books are very useful - so many Perl programmers such as me never went near a CompSci class.
-----
There is one part of the review which doesn't make much sense
That said, I think there is one area of theory that this book should have spent more time on: NP completeness. NP-complete problems are solvable, but are believed to be inherently hard: no efficient algorithm has been discovered to solve them. For programmers, the important thing is first to recognize that an NP-complete problem has been encountered, and that it cannot be solved exactly except in small instances.
A big part of this is simply wrong. Problems are NP-complete if it is proven that there is no algorithm which solves it in polynomial time. What he describes is NP-hard. His basic requirement, finding out if a problem is NP-hard needs some literature research. To recognize an NP-complete problem one can read about it if it is known. If no literature is found, showing that the problem is NP-complete will take skills on highly advanced levels.
RSA crypto is a good examples: It relies on factorization being NP which has not been proven. It uses so calld strong primes to avoid polynomial factorization algorithms.
If it's Perl you're looking to get into, the Great O'Reilly offers up a number of books, including Learning Perl, Programming Perl, Advanced Perl Programming, the Perl Cookbook, etc. Start out with Learning Perl. Some other posts mention Python, which is also good for CGI, and you can pick up O'Reilly's Learning Python and Programming Python. Be forewarned, though. I've used both for CGI programming. And when I'm using Python (powerful though it is), I find myself longing for the regexps of Perl.
If you'd like an online tutorial, you might want to check out The CGI Resource Index, which is made by the same guy as Matt's Script Archive. Between the tutorials on the Resource Index, looking at the source of Matt's script, and reading the O'Reilly books, you can learn just about anything you want to know about Perl.
Of course, if you get stuck, you can always go to ng's, irc, or your local Perl nut.
Chapter 10, 'Geometric Algorithms' is available in PDF format, here.
--Kevin
=-=-=-=-=-=
"I think the P-Funk Mothership just landed in my back yard!"
I've been looking for the same thing. Seems every book on programming (regardless of language) I've seen assumes some background in programming. If I could get a good introduction to programming, I might be convinced to take some CS classes. But untill then, I can't afford to spend the time/money on something I might have no aptitude for.
Maybe you'll return to Minagua, You could go unnoticed in such a place. -FZ
Mastering Perl Device Drivers? :-)
I have some experience developing server applications in Perl. In short, as the app got more complex, I found Perl increasingly more difficult to use. The OO model seemed like a big hack, not unlike the rest of the language. It's very unreadable to me. Readable Perl can be written with some effort. More often than not, its overly flexible syntax leads to a lot of terse or confusing code, especially when non Perl experts try to write it. e.g. everything is done with regular expressions Don't get me wrong -- when I learned Perl, it was the coolest thing. It was great for quick hacks, very powerful. But as an application language it just seems way too loose. Yeah -w, use strict, etc. It was just not designed from the ground up to deal with modules very well. Java's package system is much better. I would much rather use Java (or Python or Smalltalk) for anything other than utility scripts (which Perl is really good for). I notice that even a lot of web sites are moving away from Perl CGI scripts to use JSP and so on. I suspect they found the same thing I did - Perl isn't a very good language for developing _large_ maintainable apps. So what does this have do with with the review? Well, I'm trying to figure out why someone would be studying algorithms in Perl. I guess O'Reilly has to capitalize on the Perl wave and suck every last buck they can from it. I suppose Perl's expressiveness makes it okay for expressing algorithms. Indeed it is easy to do some complex things (though data structures are a big hack too). I think Perl has seen its day, and will quickly be relegated to a system utility scripting language.
I have some experience developing server applications in Perl.
In short, as the app got more complex, I found Perl increasingly more difficult to use. The OO model seemed like a big hack, not unlike the rest of the language. It's very unreadable to me.
Readable Perl can be written with some effort. More often than not, its overly flexible syntax leads to a lot of terse or confusing code, especially when non Perl experts try to write it. e.g. everything is done with regular expressions
Don't get me wrong -- when I learned Perl, it was the coolest thing. It was great for quick hacks, very powerful. But as an application language it just seems way too loose. Yeah -w, use strict, etc.
It was just not designed from the ground up to deal with modules very well. Java's package system is much better.
I would much rather use Java (or Python or Smalltalk) for anything other than utility scripts (which Perl is really good for).
I notice that even a lot of web sites are moving away from Perl CGI scripts to use JSP and so on. I suspect they found the same thing I did - Perl isn't a very good language for developing _large_ maintainable apps.
So what does this have do with with the review? Well, I'm trying to figure out why someone would be studying algorithms in Perl. I guess O'Reilly has to capitalize on the Perl wave and suck every last buck they can from it.
I suppose Perl's expressiveness makes it okay for expressing algorithms. Indeed it is easy to do some complex things (though data structures are a big hack too).
I think Perl has seen its day, and will quickly be relegated to a system utility scripting language.
Problems are NP-complete if it is proven that there is no algorithm which solves it in polynomial time.
...factorization being NP which has not been proven
Wrong. Problem A is NP-complete if there are no problems in the set NP that are harder than A.
Furthermore, no one has yet proved that NP problems cannot be solved in polynomial time, although it is widely suspected this is true.
What he describes is NP-hard.
The classes *I* took used "NP-complete", "NP-hard" and "hard for NP" synonymously.
Again, just plain wrong. Prime Factorization is known to be NP (NP-complete, in fact). What is NOT known is whether PF can be solved in polynomial time.
It sounds very much like you picked up your Computation Theory knowledge by reading posts on Slashdot. I don't recommend that for people who enjoy flaming.
---
Linux MAPI Server!
http://www.openone.com/software/MailOne/
(Exchange Migration HOWTO coming soon)
What?? Algorithm books are supposed to be ... surprise ... about algorithms! A book on algorithms shouldn't be able to make you a Perl wizard. Think about Sedgewick's excellent algorithm books. Basically, the are the same book with the examples replaced in different languages. Also, think about Knuth's books. They don't even use a real programming language (MIX, yuck!). All of my graduate-level algorithm books us psuedo-code (that usual resembles modula-2 or its like). Learn a language by studying algorithms? Bah!
In my opion this some book's algorithms are on the useless. Linked lists, while nessecary in some languages, are incredibly useless in perl. Hashes and dynamicly sized arrays eliminate the need for this. Sorting is covered, but perl has builtin sorting, and builtins are always faster than anything you'll write in perl. This is only the first 150 pages of the book. Those pages also include things like heaps and binary trees.
I have this book in my library, but don't think I'd buy it again if I had to rebuild it. It's one of the few perl books that collects any dust on my self.
Python is also conceptually simple, but it stresses operator overloading over object re-use and inheritance trees are typically pretty shallow. Lack of types make for code that's quick to write, not too hard to read, but you have to check them well because your arguments could be anything.
Maybe there should be an "Algorithms in Python" book. The language is ideal for beginners - even moreso than Java because of built-in lists and hashes.
Just my minor nit about typing :)
Ita erat quando hic adveni.
Seriously - read the subject. OOPerl is an amazing book - perhaps the only perl book you'll need. It's very concise, very clear, and the code you end up producing is clean code, not unlike Java or Python code.
Really though you're trolling. Sure there are things wrong with perl (like the fact that the second argument to bless isn't mandatory), but you can create crap code in any language. If you have experience of building a large app in perl and it all went horribly wrong because it got too large - you only have yourself to blame.
Matt. Want XML + Apache + Stylesheets? Get AxKit.
Oh, yeah. Everyone in comp.lang.perl loves Matt Wright's work.
Buy an O'Reilly book.
You're coming at this completely wrong. First, learn to program. You don't complain about books published for physicists that aren't good for people can don't know arithmetic. This book is *not* for you. Why would you think it was? Yes, you have to know something first. A lot of books are like that. A lot of programs are like this.
First, I'm not a CS type person. My most valuable book for programming, especially linux is Beginning Linux Programming. This little jewel covers a wide range of topics and languages used on linux systems. Everything from bash to c to perl/cgi to tcl/tk to x. There is a new edition out (2nd) which appears to cover gtk+ for gnome as well. I've not looked at this one. I think that every Beginning Linux Programmer need Beginning Linux Programming. Andrew N.
"You never know when some crazed rodent with cold feet might be running loose in your pants."
-Calvin
Some of the strongest proponents of free software are completely against the GPL. It's not free of restrictions. That's why it's not free. However, most of them don't bother to show up to this den of Linuxness and GPL flag-waving. Tom does. But now than anyone who blasphemes against the Holy Father, the great Richard "I can pontificate if I want to" Stallman gets robomoderated into oblivion here, the real thinkers don't bother. Plus, they've been through those arguments before. Tom should just realize that the GPL cultists will never see what he's talking about and give up.
The Perl Cookbook is a better book for learning perl than Learning Perl. Which is weird, because the same person wrote them both. I guess he figured out his mistakes.
Try "Elements of Programming with Perl". It's the best book out there for nonprogrammers. Learning Perl is terrible.
I've always found it easier to understand mathematic concepts transcribed to code because of the lack of vagueness allowed by computer languages. The author can't skip a step(s), refer broadly to previous concepts that may or may not have been explained/understood, or hide ideas necessary for full understanding by invoking the classic "you don't need to know this yet" mantra extolled in most lower level mathematic books.
I find also that because computer languages have been engineered from the ground up to reuse previously mastered concepts ( functions & | objects) they lend themselves well to explaining very complex ideas.
Higher level mathematics can and are expressed as proofs, lower level mathematics should be expressed as computer algorithms..? Written in perl? Works for me!
This book is just fun. :)
Matt should be shot. That code is insecure crapware that gives Perl a bad name. Fucking script kiddies.
It goes both ways. People shouldn't attack Tom without cause, and he should try to understand that having a different opinion WRT the GPL than he does is a legitimate thing to do.
I picked up Lutz & Ascher's Learning Python just over a week ago, and I already love it. One of the great things about Python as a learning language is its "interactive" mode; run the interpreter without a program file ("module" in Python terminology), and you get an interactive prompt. Just start typing in statements; you can define functions, set variables, load modules, etc. Anything with a return value displays that value. It's a lot easier for experimenting with different statements than the usual cycle of edit a file, run it, edit it again, run it again, etc.
I've seen Python described as "pseudocode that runs", and so far, I have to agree; it pushes you toward writing more readable code. Yeah, yeah, yeah, "you can write readable or unreadable code in any language", and that's true. But where Perl seems to require additional effort to write readable code, Python seems to require extra effort to write unreadable code.
Weblogging Considered Harmful:
#perl is calling you back, script kiddie. We'll ban your ass again.
Kurumi http://www.kurumi.com
Yes, people should post substantiated, on-topic, reasoned points of disagreement with Tom, not resort to name-calling. Tom should realise that people are free to use the GPL if they want, and the GPL people should realise that if someone really wants to use a non-gpl license, they are allowed to do so.
Introduction to Algorithms, Cormen, Leiserson and Rivest (yes, Ron Rivest, the R in RSA).
Far more mathematically rigorous than the O'Reilly book (from what I read of the O'Reilly book in the bookstore - I didn't buy it because it didn't look like much I didn't already have). No actual code, just pseudocode. I think this is the book you want if you really want to learn about algorithms (but not if you just want to get stuff done in Perl).
It's expensive, but it's a tome (>1000 pages). It was a good class textbook and still makes a very good reference. Check out the Table of Contents.
/* The beatings will continue until morale improves. */
It's a matter of opinion that the GPL is good or bad. It's not a matter of opinion that the GPL is not free of restrictions. Why do people get so jammed on for wanting the world to have more software that's string free?
Please don't spam public areas with your MLM bull5h1t.
Alladvantage is a network-marketing ad-viewing something-or-other scheme; not really constructive; it US$0.50 per hour "payment" for browsing the web might be good for beer money if you're homeless and surf at the library.
Alladvantage claims you can email abuse@alladvantage.com to report spammers and they'll yank the account (in this case, HBB141,
from the URL). I'll check in a day or so to see if they did that.
-- AC
The very recently released "Elements of Programming with Perl" from Manning Publications is a great book for learning Perl as a first programming language. Their "Object Oriented Perl" is also an excellent book if you want to master OOP in Perl.
No, it's not the best code in the world. But it's a nice starting point. A newbie sure doesn't want to try to read my code.
more than likely it's because Tom professes his love for vi... damn... it's so far beyond me how anybody could use vi, let alone get a hard on for it.
Doesn't Larry Wall (creator of Perl) work at O'Reilly now? If I'm remembering correctly, why is it that we haven't seen any Perl books written by him except the Camel book? I'm knocking the man, he rocks, but I'm just wondering. All the Perl books seem to be written by Christensen and the other Perl luminaries.
Maybe he's spending all his time on the next State of The Onion...
Why does every fucking thread degenerate into a flamefest against tchrist? Get a life!
It is *NOT* a nice starting point. It is *COMPLETELY* wrong. It causes brain death. It should be a felony. *NEVER* go near it.
Oh yes. We always hate people for their editing skills.
No way. For someone who has never programmed before, any oreilly book is probably a bad choice. (They are great if you have, though).
...because the code examples arent executable, the reader is forced to 'translate' the algorithm into the language of their choice, instead of blindly copying and using the example 'as is'. Needless to say, the process of slightly rewriting the code into your language aids the understanding and remembering of the algorithm.
Yeah, you definitely won't want to start your programming experience with algorithms if you're new to programming.
I would also really suggest that your first programming language be something (anything! ;-) ) other than Perl. It's really easy to use, but it makes it so easy to fall into bad programming habits. This is a good thing if you already know what you're doing, but a horrible way to start programming. This is one of the main reason why Perl gets no respect in academia -- it's still pretty much viewed as a toy language. That said, I probably have written more code in Perl than I have in any other language by an order of magnitude. I'm serious, though, don't let Perl be the first language you learn.
Something I'm really starting to enjoy is Python, and it seems to be picking up steam, so I'd strongly recommend O'Reilly's Learning Python, which seems to be about a gentle introduction to a programming language as it gets. (I'd give Learning Perl 2nd-place honors here. I still don't recommend you start with Perl, but I'm not sure why so many people dislike this book as an introductory text -- it lets you do useful things pretty much right away.) I wasn't too pleased with Programming Python, especially compared to Programming Perl, so I ended up learning the language from the Learning book and then using the great online documentation.
If I had a gentle Java book to recommend, I'd give you that as well, because despite all the troubles, I think a lot of people will eventually use it, or at least variations of it. Like Python, it'll help get you acclimated to object-oriented principles, which I recommend, and there is plenty of sample code out there for both. Not as much sample code as Perl, but you don't want to get your feet wet with Perl, do you? (Sensing a theme yet? ;-). Also, it's pretty much taken for granted that the Python folks seem like great guys and very helpful, and that the Perl guys are, well, not the friendliest people around. Jon Orwant (a Perl guy who, along with Larry Wall, I do like) was even quoted in this month's Linux Journal that the Python guys seemed nicer. Considering the dim view that many in academia have of Perl, I'm not quite sure exactly how so many in the Perl community turned out to be egotistical/self-righteous dicks, but it sure seems like it's happened. (And no, this isn't why I'm urging you from starting out with Perl -- I still use it all the time myself.)
Cheers,
ZicoKnows@hotmail.com
Apologies for the topic drift, back to the regular discussion.
-----
The real meaning of the GNU GPL:
The real meaning of the GNU GPL:
"The Source will be with you... Always."
Ok, ay caramba. Slashdot is really showing it's stuff, today.
:)
Yes, NP-complete and NP-hard are not synonymous.
So:
NP means "polynomial-time verifier".
NP-hard means "reduce to NP in polynomial-time".
NP-complete means "NP and NP-hard".
But, these all refer to classes of computable problems.
The halting problem is the prototypical "not computable" problem. Thus, it is not in NP-hard.
Hehe, I hope I got that right
nick
I think that this was the best Perl book I have ever read (Programming Perl and all the other ORA Perl books coming in close, but then again I've only read Perl books by ORA so Ihave to broaden my horizons), but it is a first printing of it. It has a lot of major errors. I highly reccomend that you visit the author's errata page before reading it and fix at least all of the major errors (there are a few). The author's errata page is more complete and will be updated as errors are found more than I would expect the ORA site is, so I reccomend that you use his site instead of ORA's site for errata concerning this book. Don't make the list of errata scare you though it is a great read and I myself am halfway through reading it in full for the third time.
If you think you know what the hell is going on you're probably full of shit.
If you think you know what the hell is going on you're probably full of shit.
jdube is who I am
Ok, this comment has a lot of inaccuracies. Let me try to clarify.
NP stands for "nondeterministic polynomial", and is probably most easily understood as the class of problems for which the solution can be verified in polynomial time. It includes P, the class of problems that can be solved in polynomial time.
A nice example of a problem that is in NP but not known to be in P is satisfiability. This problem is given as a list of predicates of the form (x1 or x2 or not x3). The problem is finding a set of xi such that all of the predicates are satisfied.
So, it should be obvious that you can verify a solution in polynomial time - just start with the values of xi and check that all the predicates turn out true. However, there is no known general technique for solving this problem than enumerating all the possibilities, which takes exponential time.
NP-completeness takes this idea one step further. It is a large an interesting class of problems that are basically equivalent in difficulty. If you solve one, you've solved them all. Thus, if a problem is NP-complete, there's no known efficient algorithm.
The way people analyze NP completeness is do define reductions, ie show how instances of one problem can be reduced into instances of another NP-complete problem, and vice versa. Maybe this takes "highly advanced skills," but it's actually fairly routine for algorithmicists.
The class of NP-complete problems includes the travelling salesman problem, the Hamiltonian path problem, the knapsack problem, determining collisions of 3D objects, and many others.
NP-hardness is when you can reduce an NP-complete problem into the NP-hard problem, but not necessarily vice versa. Many integer optimization problems are NP-hard.
Factoring is clearly NP, but is not known to be NP-hard. It's entirely plausible that someone (Arjen Lenstra, for example) will come up with a polynomial factoring algorithm, but leave the rest
of the NP pantheon untouched.
There are some crypto algorithms that are based on NP-completeness, but NP-completeness is not in and of itself enough for strong crypto. Even if the problem is hard in general, a specific instance may be easy to solve. Unless you can prove that this never happens, you're hosed. IBM has done some excellent work in this direction with randomized self-reductions for their lattice-based crypto algorithm.
Complexity theory is one of the most beautiful areas in computer science, and NP-completeness is one of the most striking results, as it illuminates a fundamental unity across many seemingly disparate subfields of computer science. It is indeed a shame that this book skimps on its coverage of NP-completeness.
LILO boot: linux init=/usr/bin/emacs
Perl makes it easy for absolute newbies with no compsci at all to get a *lot* of work done. You don't need to be a compsci phd to use it. I bet there are 20-50 ugly misdesigned horrible perl programs out there for each one. You know why? That's the same ratio of nonprogrammers doing programming compared with trained programmers. So what? Why do people shit on perl because it helps regular people like us theatre majors get some hacking done? You want to ban it? Maybe make a law so only degreed people can program? Require us all to use C++? You people sicken me.
What about this perl cookbook? I saw it in the the store, but didn't look. It's that script archive guy's.
The reason that Scheme is not as well known as a programming language is that it is sort of the "learning beater car" of programming languages. Scheme's main utility advocates are in AI and its sub-disciplines, so commercial applications will not be written in Scheme. There is no great market for Scheme programmers, but there is a market for programmers who can understand the fundamentals behind great programming. I think that this book especially lends itself to the beginning programmer- and for web support of all kinds the Scheme Repository of Indiana University is rivalled only by the Schem Underground at MIT.
Good luck in your programming endeavors!
Didn't Richard W. Stevens use vi, too? Hm....
No, I don't have a reference handy. But I could swear we did this in a senior level computation theory class about 4 years ago.
I'm not angling to repeat the nightmares that were my attempts to reduce problems to other NP-complete problems, but it seems pretty obvious that PF is in NP. I can definitely verify a solution in polynomial time. All that would remain is to show that the number of primes increases at the same rate as the number of possible solutions to a SAT problem. Now that I think about it, I don't think the number of primes grows exponentially, so maybe PF isn't NP-complete. Huh.
---
Linux MAPI Server!
http://www.openone.com/software/MailOne/
(Exchange Migration HOWTO coming soon)
Do you think we'd have as many CGI kiddies if we'd all used Scheme instead of Perl?
Here are some links for more information on the book:
Andrew's home page for the book at Manning Publications
a review by Billy Baron of Delphi Consultants at javamug.org
an online Perl programming course using Elements as its textbook
Disclaimer: I am from Winnipeg, and know the author.
Okay, I know that this is probably a catch 22 question, but what do you want to program for?
There are plenty of amazingly well written books on the subject.
Personally I guess I would suggest trying to pick up a Kernigan (Programming C), Any of the O'Reilly 'Learning' books, and if you feel adventurous you might even try Knuth's Art of Computer Programming series.
If you've got a clear idea of what you would like to learn though the best thing to do would be to go to the book store and just start flipping through books and see what you like.
Good luck!
This space for sale
You can swear all you want that factorization is NP complete, but if you actually proved this, it's a new result worthy of a PhD at the least.
The complexity of prime factorization is not known at this time.
I even said that Perl is really easy to use, that you can get useful things done right away while reading Learning Perl, and that I've written a lot more code with it than any other programming language. Why would you think I'd want to ban it? (Yeah, I know you were exaggerating, but still.)
The guy to whom I replied said that he was looking to learn programming, not to learn Perl, or had some specific thing that he needed to get done. I just don't think that learning Perl is very helpful if you're looking to learn programming in general or plan to use other languages later. I definitely wasn't attacking Perl.
As to the other person who replied to me: The Perl Cookbook is great (I own the Perl CD Bookshelf which has it and I have the dead-tree version at work), but I wouldn't recommend it to someone who, like the person whose post I answered, has never done any programming before. I'd suggest checking out Learning Perl first so that he isn't totally lost by things like all those expletives in the language ($@_!#%) ;-).
Cheers,
ZicoKnows@hotmail.com
The best introductory Java book I've seen is Beginning Java from Wrox Press (can't remember the author). Don't know how good it would be for a rank newbie, but every other Java book I've seen has been even more newbie-unfriendly. Bruce Eckel's Thinking in Java might be better for an experienced programmer trying to pick up a new language, but might cause a porr non-programmer's head to explode.
Weblogging Considered Harmful:
I'm not knocking Perl as a language - I use it all the time - but it's not suitable as an introduction to programming. I've not used Python, but the reasons that other posters have put forward suggest to me that it may be appropriate.
At our school we teach the functional language
Haskell in our first course, then C. Java, C++, and even a little Prolog and Assembler are taught along the way through. Haskell is a great teaching language, partly because it knocks the smart-alecs who know C++ before they get in to university back on their arse, partly because it's a great introduction to some pretty clever concepts like strong typing and recursion.
However, for someone having a taste of programming to see if they like it, it's probably a little intimidating and not easy to immediately write useful programs.
Any sufficiently advanced technology is indistinguishable from a rigged demo
--Andy Finkel (J. Klass?)
He was a really nice guy, and he told quite a few interesting stories.
Call me old fashioned, but I think that C is probably one of the best languages to learn first because the language itself is very simple unlike perl, it forces you to think about memory management (which IMO is a good thing, if only to gain an understanding of how it works). Books that I have found good for learning are "the C Programming Language" by Kernighan and Ritchie, and "Practical C Programming" from O'Reilly.
I believe that the number of primes grows logarithmically. Fortunately, I found a link, too! :)
---
pb Reply or e-mail rather than vaguely moderate.
pb Reply or e-mail; don't vaguely moderate.
I learned Basic, Pascal, and assembly language before I learned C. I think that was important. Basic let me program without worrying about busywork, just getting done what I wanted to get done (Perl could do that today, I guess). Pascal taught me rules and crud. Asm was for memory and pointers and all that. I don't think without those three, that C would have been very easy. As it was, it was.
When I started learning perl, I figured a good way to do it would be to a) read the camel, b) look at lots of code. Matt's stuff is all over the place so I started reading it. It took me ages to weed out the bad habits I acquired.
Except as an excercise in correcting other people's mistakes, don't touch the stuff.
This is the voice of World Control. I bring you Peace.
That's worse than looking at Microsoft on how to design Operating Systems - at least Windows works for certain values of "work", which is more that you can say from Matts scripts. There are daily complaints in comp.lang.perl.misc about people having problems with his scripts.
-- Abigail
No, it's not. It's bad code, and because it's bad code, it's a very bad starting point.
-- Abigail
LEARNING PERL!!! Is the only book for a non-computer science major to "get it out of a book". Perl is a high level language based on C. It is extremely friendly to use. It uses complex inate data structures that, if I had to make them in C++, would be a b*#$h! You will never know how much programming work Perl takes off your hands unless you know another language. It is the most widely used programming language on the web (HTML is NOT a programming language), and it helps you gently (as gently as is possible - programming is not easy or everyone would be doing it) learn the logic and structure of a program. I cannot recommend "Learning Perl" enough. Plus if you want to get into C or C++ later, it will look pretty familiar, but will piss you off with how picky it is. I saw that someone recommended "Learning Python." While Python is a neat language, it is not widely used or supported, and it is very syntatically picky. My advice to anyone beginning programming - Learn Perl. It is popular, C-like, and if you want to do something fast there is no better language. This is a great book, but not something to start with. When you can do just about anything you want to, but cannot consider yourself a "master programmer" yet, get this book. It is advanced/intermediate material. Good luck and have fun :)
Hellllooooo out there! Use the right tool for the right job. There is no language better for writing quick and dirty scripts that Perl. There is no language more portable and modular than Java. There is no language more widely supported than C. Suit the tool to the job and you won't have these conflicts.
It's lack of memory management is one of the reasons C sucks as a first language. It makes the beginning programmer get lost in details better left to the computer; taking away his/her time from focussing on the problem. Perl as a first language sucks too, but for different reasons. Python, Java, LPC, Ada or something from the ML family are much more suitable.
-- Abigail
Or it might be that Tom has all the social graces of a wolverine. Don't get me wrong - he is brilliant and writes excellent software and documentation far above the call of duty. But he is _also_ without question a self-important prima donna who is the poster child for 'does not play well with others' and would never be hired by many shops because brilliance doesn't replace the simple ability to _get along_ with others.
I guess that's because in order to master something as powerful as vi, you'de have to read or something, and it looks like all you know how to do is point-n-click. Bet you like VB.
When you can buy the book, plus several others, on a single CD!
Dr. Dobbs has it as part of their Algorithms CD. It has full text searching, too!
Not only that, but the price is lower than you would normally pay for the CRS book alone.
My only complaints are:
- the interface was a bit weird and buggy
- you can only browse it using the supplied Windows app (I think; I lent it to someone and never got it back).
Graham
Wow... I'm still sad about his death. I never heard how he ( Richard Stevens ) passed away. Does anybody know what the cause of death was?
Some parts of the book don't contain more than "if you want to do `foo', just call the function (or method) called `foo' in this package". I really, really don't need a book to state what I can find easily in a manual as well.
In the parts they do discuss algorithms, they often get side-tracked, by either explaining language features, or showing a trick that saves 0.5% of your execution time. The important things get burried in the details. It has been argued that having "real code" and not pseudo-code is a feature. In my opinion, this books makes an excellent argument in favour of pseudo-code. Pseudo code doesn't have to bother with language details, and people writing pseudo-code have to waste time wondering whether an alternative construct saves 1% of time. An algorithms book should focus on algorithms, not on the language.
If you want a bag of tricks, get Effective Perl Programming, if you want a bag of useful code snippets, get The Perl Cookbook, if you want to know modules, read their man pages, and if you want to learn algorithms, get a real algorithms book, like Cormen, Leierson, Rivest, Knuth's The Art of Computer Programming, or something from Wirth or Mehlhorn.
-- Abigail
"Portable Java" means it runs on both Microsoft and on Solaris. Big Fucking Deal! Let's just list out the first couple score of systems that Perl runs on. It makes Java seems as portable as assembly language. Yup, this is a hissy message, but I just *hate* it when technicians swallow the marketing hype hook, line, and sinker.
You are out of your mind. Learning Perl is a prissy little book of no substance that revels in self-congratulation and clevernesses. Sure, maybe an arrogant Unix sysadmin might learn Perl from this, but nobody else ever will. Get "Perl: The Programmer's Companion", "Elements of Programming in Perl", or even the "Perl Cookbook". All are about a million times better than Learning Perl. Learning Perl is weak, limited, assuming, and badly written. It's all footnotes, and no insight. It looks like it was written by a Unix geek about ten years ago. It is assumes you know programming, but treats you like an idiot. Yes, the Programmer's Companion (a tutorial) and the Perl Cookbook (a recipe set) assume you're a programmer, but at least they don't assume you're a *bad* one! And Elements of Programming with Perl is a complete and wonderful gem. Learning Perl should be burnt.
It is the curse of the brilliant to not suffer fools gladly. Tom's a genius, not a saint. You expect a lot.
I think you just have to take the plunge and take an introduction course. Trying to learn from a book is pretty hard in general. I tend to believe that books are better at extending knowledge, not as good as a starting point especially something very conceptual like programming. A live class, imo, will give a better introduction.
- Computer Algorithms: Introduction to Design and Analysis 3rd Ed
by Baase and Gelder. I just took my intro to algo course in which this was used as a text; it is very much readable and the examples really do illustrate the principles they claim to. It spans every thing from a base level introduction to NP-complete.Banfield
He is God, and has acheived more than you ever will.
Consider conditional expressions. In Algol, they read
:= if b then c else d
:-)
a
A dozen years or so later, C said it more clearly as
a = b ? c : d;
Then Perl helped remind you which items were variables.
$a = $b ? $c : $d;
And now Python (courtesy of Programming Python, p. 135).
a = ((b and [c]) or [d])[0]
That's how I *always* wrote it in pseudocode. Didn't you?
Oops. I had the Dylan programming language mixed up with some other Apple product code-named "Sagan". Carl Sagan sued Apple over the name, and lost. Apple changed the development name anyway, to "BHA". When word got out that it stood for "Butt-Head Astronomer", Carl sued again, and lost again. Later, when Apple began work on its Dylan (dynamic language) programming language, Bob Dylan sued. I don't know how (or if) the suit was resolved, but I don't think Apple has had to rename it to "BHM". Yet.
Weblogging Considered Harmful:
It's the best Perl related thing you can buy. Buy it, it's worth every penny you pay for it - and then some.
-- Abigail
Others have responded that Matt's scripts aren't really a good source of information on how to program perl idiomatically, or maybe even correctly. :-)
But to add something to this thread, I'd like to point out that you really, truly can learn much more about Perl than you'd ever get from Matt's Script Archive by going to the Perl home page at www.perl.com
After you've spent a couple of weeks digesting that, it is possible that you would want to know even more, so you can go to Tom Christiansen's Far More Than Everything You've Ever Wanted to Know About... web page, if you haven't already. Oh yeah, and you can buy O'Reilly books, too. :-)
Babar
Dylan writes incomparable poetry, but that awful noise that results when he gets near a mike is enough to curdle motor oil.
Nasal, slurring, intentionally off-key, he's the most unlistenable great in the business (this from an AC who can listen rapt to Jerry's whining and honking for hours).
I'm surprised you made a claim like this without backing it up...
R is definitely for Rivest. Check the "What is RSA?" section of RSA's cryptography FAQ. I quote directly:
RSA is a public-key cryptosystem that offers both encryption and digital signatures (authentication). Ron Rivest, Adi Shamir, and Leonard Adleman developed RSA in 1977 [RSA78]; RSA stands for the first letter in each of its inventors' last names.
/* The beatings will continue until morale improves. */
I've read all the O'Reilly Perl books. It seems to me you don't start learning how to write good Perl until somewhere around Advanced Perl Programming. Especially since Christianson has a nastly habit of using every module he can find without ever telling you what's going on behind them. For instance, in all the shortcomings of Matt's code, at least he knows how to parse STDIN and the QUERY_STRING for CGI input. Christianson just uses CGI.pm. Does he even know how to parse the data himself? Because he sure doesn't find it necessary ever to detail it in any of the books he co-authored. Talk about bad habits.
Why would he bother? That's not what the books are about. Show me a book of his that tries to explain all the details of the CGI protocol.
Face it: most people do this wrong. Even if you explain it to them, they'll do it wrong. Let's make a bet, buster. Go ahead, post your idea of the right way, since you're so smart. Go ahead. If you get anything wrong, you can send Tom an apology.
Well, I have this weird thing where I tailor the code to a particular app. So I can't give you some always-used snippet. There are times when I want to do more with the input than other times. Hell, I recall one time I didn't even want to do the hex decoding on a part of a query string. But of course, CGI.pm does that automatically, so if I had used it, I would have had to re-encode it. How very efficient.
I have never had a problem with the way I parse CGI data. Not once has it caused anything to happen in my programs that I didn't expect to happen. And I've written plenty of fairly-complicated programs, and none of them use CGI.pm. That is, after all, my job. I might do it differently than CGI.pm (I don't know, I've never read the code for CGI.pm), but of course, There's more than one way to do it.
And if my way of doing it is slow and inefficient, then I'd say Tom owes me an apology for never showing the best way. I spend $35 a piece on those books. You'd think they could tell me something I couldn't learn from the manpages. (In case you hadn't noticed, Chapter 3 of the Camel is just the perlfunc(1) manpage, with a few words changed.)
And that whole "hide the details for fear they'll do it wrong" seems a very Microsoft-like philosophy to me.
You are evidently too cowardly to put your code where your mouth is. Let's see your code, smart ass.
Just ignore him. He's an idiot who can't code.
What an amateur.
read(STDIN, $bfr, $ENV{'CONTENT_LENGTH'}); /; /;
foreach (split(/&/,$bfr)) {
$kv = [split(/=/,$_)];
foreach (0...1) {
$kv->[$_] =~ tr/+/
$kv->[$_] =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack("C", hex($1))/eg;
}
$form->[0]{$kv->[0]} = $kv->[1];
}
foreach (split(/&/,$ENV{'QUERY_STRING'}) {
$kv = [split(/=/,$_)];
foreach (0...1) {
$kv->[$_] =~ tr/+/
$kv->[$_] =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack("C", hex($1))/eg;
}
$form->[1]{$kv->[0]} = $kv->[1];
}
I pretty much start everything from there, depending on what sort of HTML I want to cut out or put in. Of course, this would have to change if I had a select box that allowed multiple choices, or if I had a file upload or other multi-part form data. But since I write the snippet for the app, I know what the form is giving me. And I don't cut & paste. My indentation is wildly different, but every time I previewed on Slashdot, it stripped the 's out.
As I said, I write CGI programs all day long. That's how I make a living. And I've never had a problem with this.
And since you're advocating we not show poeple how to do something because it might be "complicated", do you suppose we ought just to close the source of Linux?
How about a more complete example? One with file uploads, radio buttons, etc.
For radio buttons, I wouldn't do anything different. (Why would I?) For select boxes that allow multiple selections, I'd know the key that it's coming in as, and push values into an array for that key.
As for file uploads, I'll be quite honest. I haven't taken the time to learn the hairy details of MIME yet (actually, I'm reading up on that right now), so I use cgi-lib.pl. But this isn't really CGI specifications. It's MIME.
Without seeing the code for those important parts, I can't say for sure, but given the rest of the non-industrial strength code, one can easily imagine the worst.
That would read better like this:
Because otherwise you have too much needlessly duplicated information.Better yet, you should just split into my ($key, $value) and loop across those in the same way. The anonymous array just seems to hurt legibility.
That should be far more than enough nits and gnats to keep you thinking for a while.
Absence of evidence does not imply evidence of absence.Here's my suggestion: read the CGI.pm source very, very carefully. There's a lot to learn. Good luck. Hopefully, you'll repent of your hackish ways that help give Perl a bad name by spreading bad CGI code around the world.
I shan't be tilting at any straw windmills.I shall, however be patiently awaiting your public apology and contrition.
OK, a few of these are valid points. Most of them totally miss the point of what this snippet is.
You have a bug in your split....
This code is not all-purpose. It is about the simplest parsing I would put in the beginning of one program. If I know the form's going to hand me something funky, I'll handle it. Since I write the code for the form, I can do that.
Are you aware that the CGI spec from W3C deprecate the use of & and insists on semicolon?
No, I didn't. I'll check into that. And I'm sure I can handle it.
Your code can only handle trivial forms...
Yes, I know. As I said, this is a simple example of what I would put at the beginning of a program. This is not all-purpose. There's no reason to parse stuff that I know won't happen for a particular program.
You didn't test for whether you had a GET or a POST request.
You'll notice that I read both the STDIN and QUERY_STRING. I put the STDIN (from a POST) into %{$form->[0]}, and the QUERY_STRING (from a GET) into %{$form->[1]}. This way, I have whatever came across either stored right there, and I can allow a particular script to take either REQUEST_METHOD, and act accordingly for each.
You have duplicate code.
Yes, I know. I've written it before without duplicate code, using some fancy anonymous subroutines (I love those things), but I didn't feel like it for this example. This was a simple example.
You didn't guard against a denial-of-service attack through too much data...
Again, a simple parser for a form I know will be simple. I'd write something better if I had something bigger.
You never declared any of your variables.
My snippet isn't being used by anybody else. No, it is not use strict clean. But my programs don't use strict. I'm just way too fond of symbolic references.
Your use of magic number, 0 and 1, is confusing.
Maybe to som. As I said, this isn't supposed to be used by anybody but me. Actually, I intentionally obfuscate my code sometimes to make sure the amateurs in the office don't screw with my code.
You have duplicate code.
Why yes, I see the problem. Except that the performance loss won't be noticed when all of this has to be served through some schmuck's 56k dialup.
All in all, some very nice points. A few things I wasn't aware of. A few things I was. And so, now that the entire office has laughed at me for having my code picked apart by Tom Christiansen (OK, yes, I laughed at me too), I'll apologize for doubting you could do it. But I don't apologize for expecting you to impart that knowledge on the rest of us in your books. If there were some useful reference material out there, perhaps I would be doing it better.
As for the matters of strict, your disdain for robust coding should scare the hell out of any employer or co-worker. And symbolic reference are 99% of the time used because someone had no clue how to build a proper data structure.
You have a long ways to go yet in becoming a competent software engineer. And you don't seem to be on that path right now.
There's much more to CGI than you seem to realize. For example, do you even understand the critical semantic difference between GET and POST? They're hardly interchangeable.
If I should ever write a book on low-level CGI internals (which I hope to avoid), I shall be sure to include all this. Meanwhile, you should abandon your attempts at wheel re-implementation, because you're doing it in a dangerously cavalier and often completely wrong fashion. I stand by my work: the module is going to get things right that 98% of the script kiddies will never even understand. So use it.
You the programmer do not control the form.
Actually, the web developers are about five feet away from me, so I know exactly what the forms look like. No, wait. Actually, most of my CGI scripts create the form themselves. I do control the form.
And my interests aren't in chugging out code day after day. That's not very much fun. In fact, programming's not much fun and all if you don't learn something new every day. (Maybe that's just the mathematician in me.) So if I have a problem with my code, I learn from it. As for right now, I've just printed out the source of CGI.pm, and I intend to read it over the weekend.
Pay attention. You are dangerous. This is the horribly stupid perl code that people trash the language about, and you're part of the cause!
This is my last post on this topic, as the thread has strayed far enough off of the topic as it is. If you wish to carry it any further, you may email me.
Thank you for successfully proving my point. My intentions were merely to show how very little one can actually learn from the O'Reilly books. Though they are great sources for learning the basic syntactical structures of the language, there are far, far too many topics which they simply do not cover.
I can't be the first arrogant, obnoxious, stubborn little bastard you've run across. And I probably won't be the last. Actually, you strike me as rather the stubborn type. I mean, surely, you didn't learn everything you know simply from using other people's solutions. Re-inventing the wheel is the best way to understand it.
Nearly everything I know, I've learned from you. You've shown that that is insufficient. So tell me, where does one go from here?
The Perl books cover, surprisingly enough, Perl. Are you asking for a good book to learn about HTTP, CGI, and HTML from?
This is part of being a glue language. We glue to everything. We can only teach you how to attach the glue. You need to understand what you're gluing to.