Slashdot Mirror


Elements of Programming with Perl

Bringing a little competition to O'Reilly, this Manning Publications book Elements of Programming with Perl seems to be have struck a nerve with reviewer chromatic. Click below to find out how - and possibly add a new book to your library. Elements of Programming with Perl author Andrew L. Johnson pages 352 publisher Manning Publications, 09/1999 rating 8/10 reviewer chromatic ISBN 1884777805 summary New to programming, and think Perl may be up your alley? Andrew Johnson's excellent Elements of Programming with Perl will teach you both disciplines. What's the Purpose? Hundreds of books teach programming. Dozens of good books teach Perl. Where's a book for someone who wants to learn Perl and programming, at the same time? Thankfully, that's just what Elements of Programming with Perl does. What's Good? From the start, Johnson's explanations are clean and clear. It's obvious that he's polished his didactic style through years of real world teaching. Also from the start, good programming practices receive due emphasis. Though it's not specifically mentioned until chapter 9, Johnson advocates and demonstrates good program design through a mixture of Donald Knuth's Literate Programming and his own code tangling style (mingling documentation, design notes, and code in a single source file, similar to POD on steroids).

The teaching flow is logical and consistent, with chapters dividing the material into logical divisions. By the end of chapter flow, students should be capable of writing moderately complex programs. Subsequent chapters build on that foundation, and most provide a specific example program to tie things together. These programs all have a practical concentration.

On the Perl-specific side, Johnson does not shy away from recommending the copious Perl documentation, CPAN, other books like the Camel, and many other excellent resources. Much of the value of an education is learning where to go for further information.

What's not Great? Some of Johnson's focus is on mathematical applications, which may distract some readers. Also, this book may not serve as a future reference after you've become more comfortable with the language. Look to the Camel or Perl in a Nutshell for that -- Johnson concentrates on teaching the basics rather than documenting the iotas and tittles of internal Perl functions.

Finally, the example program in Chapter 19 may be hairy for novice programmers. Sit down in a very quiet room with a pad of note-paper and your beverage of choice. Consider it a final exam after you're familiar with everything preceding it.

Summary This is a good introduction to Perl, and a very good introduction to programming in general. Johnson promotes good habits and discipline. Elements may not sit on your shelf as a reference, but it will help you to become an effective programmer. It's a rare book that teaches as well as it informs, so take the plunge and teach yourself Perl and programming.

Pick this book up at ThinkGeek.

Table of Contents
  • preface
  • acknowledgments
  1. Introductory elements
    1. Introduction
    2. Writing code
    3. Writing programs
  2. Essential elements
    1. Data: types and variables
    2. Control structures
    3. Simple I/O and text processing
    4. Functions
    5. References and aggregate datastructures
    6. Documentation
  3. Practical elements
    1. Regular expressions
    2. Working with text
    3. Working with lists
    4. More I/O
    5. Using modules
    6. Debugging
  4. Advanced elements
    1. Modular programming
    2. Algorithms and data structuring
    3. Object-oriented programming and abstract data structures
    4. More OOP examples
    5. What's left?
  • appendix A Command line switches
  • appendix B Special variables
  • appendix C Additional resources
  • appendix D Numeric formats
  • glossary
  • index

194 comments

  1. Books can be over rated by OpenSpace · · Score: 0
    Give me a search engine and some open source projects. I can pretty much learn anything with out giving money to some guy who read the O'Reily books and preached it out again.

    The ultimate tool is a good set of definitions. All I can say is

    print "Good bye book world";

    print "Hello wired world";

    1. Re:Books can be over rated by Matts · · Score: 3

      That's fine if you know programming already. I can just picture an English lit graduate trying to learn programming from slash 0.9.1... hahahah :)

      And besides that - theres an awful lot of crud code in the open source world (as there is in the closed source world - but you can't download and learn from that) and I'd hate to see someone learn object oriented techniques from that rather than a good book on the subject.

      --

      Matt. Want XML + Apache + Stylesheets? Get AxKit.
    2. Re:Books can be over rated by Anonymous Coward · · Score: 0

      Hey! I'm a History grad and I learned Perl from Slash 0.4! What the hell is your problem with that?

    3. Re:Books can be over rated by tobyp · · Score: 0

      That is an "insightful" comment?

      Toby

    4. Re:Books can be over rated by warpeightbot · · Score: 2

      Any good programmer knows that sometimes there's no substitute for treeware, particularly if you don't have the monster monitor from hell on your desk. It's bloody difficult to use a highlighter on a CRT, or scribble in its margins. This goes triple for the source code you're hacking on.

      Actually, a good solution (perhaps not the best) is that new CD O'Reilly is selling that has all six of their Perl books on it, that just happens to come tucked in the back of a treeware version of the Nutshell. (It also comes with a search engine, but apparently O'Reilly's R&D department is sadly WinDoze-centric... :( ) No, I don't have the bloody URL for it. Besides, I wouldn't want to be seen as advertising one bookseller over another, particularly given the current political climate concerning a certain 250-pound-and-growing-fast gorilla of an e-bookseller we have in this town... as if Boeing and Microsoft weren't gorillas enough... jeez.

      But really, if you already have the proper filters in place and know good code on sight, then, no, books are often more frustrating than not. This is not this book's target audience. OpenSpace doesn't need the book... but my friend across town who's just getting the hang of the whole coding thang... might. My ten-year-old friend who is just being allowed to tinker with web publishing stuff for the first time... most certainly.

      Something us olde farte geeks tend to forget is that there are, in fact, newbies out there, and that if we don't train them correctly the first time, they turn into script kiddies instead of budding hackers. Doubleplusungood. Thus the need for good treeware docs.

      --
      "Hey, rat!" yeah?
      "Where's your rat hat?" (points atop flagpole) there.
      "Get it."

    5. Re:Books can be over rated by AngusSF · · Score: 1

      Give O'Reilly credit - they have put the out-of-print edition of _Learning Perl_ online at http://www.oreilly.com/openbook/cgi/

      --
      "A gun is a tool, Marian. No better, no worse than any other tool. An axe, a shovel, or anything." Shane (1953)
  2. Re:Linux? by ilduce · · Score: 1

    Unlike windows, linux distributions come with it.

  3. This fills a void by predictive · · Score: 5

    Putting aside the (flamebait) arguments that Perl is or is not a good first language, I've seen several people turn to other languages that were less appropriate for their needs (like sysadmins) because of the lack of a good beginner book for Perl

    Until now, it's been relatively easy to find books on C, C++, Java, etc for the non-programmer, but Perl has historically been supported by tomes that double as reference manuals, which are not really the best for first-time language instruction

    Even the excellent Llama book (Learning Perl) assumes some familiarity with the use of logic and simple programming concepts (like variables). This makes it doubly difficult for a newcomer who wants to harness the text-processing power of Perl but quickly becomes lost in its (admittedly unique) syntax.

    I'm glad to see a better entry point to perl for the programming newbie. Maybe now the c.l.p.m. s/n ratio will improve

    --
    So E is relatively prime to (P-1)(Q-1)... Odd, that.
    1. Re:This fills a void by nickm · · Score: 1

      Well, I learned Unix by learning Perl. After a while, I began to see that there were programs and shell tools that corresponded to some of the Perl built-ins and modules. Now I only ever use Perl when bash and gawk haven't enough power.
      As for application development, I prefer python, partly because not enough people write legible Perl. If I'm working on a project with other people, I want a language that will force the others to write legible code. Perl is just too tempting--you get into stream-of-consciousness programming.
      I applaud the introduction of the literate programming technique into Perl. I've been doing it with Python's documentation strings for a while now.
      --
      I noticed

      --

      --
      I noticed

      It's getting about time to leave everywhere

    2. Re:This fills a void by jon_c · · Score: 1

      A friend of mines first language was perl. I think it may have fucked him over a little due to all the tricky ass shit one can pull. His code was teeming with hug regexp that took him 2 hours to debug.

      Personally I think BASIC is a great language to learn first.. or python perhaps, languages that don't have a lot of nifty stuff and weird rules. Just basic variables, functions and objects.

      I've been trying to learn perl on and off for a few months, the most troubling thing I find about it is it's ability to let one do things so many ways, it's hard to know the rules, when there are so many of them. For instance I spent about 2 hours trying to figure out how to find out if a file was a directory of not. By reading the camel book and some "black perl ninja book" I found two ways..

      Use stat() and do something like a mode & 50000 on it
      Or try opening the file as a directory and see if it croaks.

      Just wishing I had a function like "IsDir()", I hack out the stat() one. Then my roommate comes home and says

      "oh you just do if (-d $var)"
      "no fuckin way", I say in disbelief.
      "ya you didn't know that?", he says
      "I looked all over the place for that... fuck!"

      now in C or C++ the "language" doesn't have anything for this. You need to use a library. And depending on what library you're using it will have a way for doing this, but the important point is that if you know stdio.h, over iostream.h ether is fine. But you'll get to know that "school" and life will be good. In BASIC the language provides ONE way of accomplishing the goal, it may not be everything you want it to be, but it works and life's still ok.

      For a experienced perl programmer at the end of the day he/she will use what's more convenient, which is good. But for someone who's learning the ropes it can be exasperating.

      -Jon

      --
      this is my sig.
    3. Re:This fills a void by StMaybe · · Score: 1

      Actually, while not very fond of other 'Teach Yourself in 21 Days' books, the manual I use with the most yellow sticky-things is 'teach yourself PERL 5 in 21 days.' I did have some basic programming familiarity, but this book at least covered arrays, hashes, some basic Win32 functions. I would recommend, if one could procure it cheaply (perhaps bookpool.com), they should pick it up. Of course, it doesn't do much for Perl/tk (use O'Reilly), or more advanced Win32 functions (see Tim Roth's book), but it is what got me hooked on PERL.

      --
      Do unto others as you would have others do unto you.
    4. Re:This fills a void by Abigail-II · · Score: 3
      But you'll get to know that "school" and life will be good.

      Of course, the -d in Perl comes from a certain "school" as well. The test function from Unix shells.

      For a experienced perl programmer at the end of the day he/she will use what's more convenient, which is good. But for someone who's learning the ropes it can be exasperating.

      And this is different from learning the libraries in C (or Python) in which way?

      -- Abigail

  4. Perl by Anonynous+Coward · · Score: 0
    Perl has far out grown its usefulness. Its a nice language for writing report generators (surprise!). Using it as a general purpose or generic glue language is dumb, as its a horribly designed throw-in-everything-including-the-kitchen-sink-wit h-no-regard-for-consistency-or-sane-desi gn language.

    Also, Tom Christensen is a fucking asshole.

    1. Re:Perl by Anonymous Coward · · Score: 0

      I agree. Tom is a mook.

    2. Re:Perl by inah · · Score: 1

      it never ceases to amaze me how people can shoot of their mouths w/o offering a shred of evidence.

      perl is FAR from out grown. there is a reason good developers have no problems charging 150/hr.

      as for perl, it's OO duct tape.

      books teaching PERL programming are not very easy to write, much less programming skills alone. hopefully, more people will make an attempt to learn as opposed to reverting to a script kiddie.


  5. Re:This fills a void but does it cover by Anonymous Coward · · Score: 0

    Open dk() at all?

    Thank You

  6. usefullness of perl limited. by Anonymous Coward · · Score: 1
    Since this story is supposed to be about the book, I suppose this post is offtopic, but I believe this needs to be said anyway.

    Perl certainly is good for many things, and it really can't be beat for many uses, but like linux, it's not an answer to every question. There are things that perl (or even linux) aren't the best solution or even an appropriate tool.

    For example, the company I work for spent over a year going down the dead-end road of trying to implement a petrified Natalie Portman in perl. After all that was canceled, we were able to have a working prototype written in YAIL (Young Actress Implementation Language, an industry specific language) within 1 month.

    Yes, there are rough edges and bugs - the finger interface can cause a spurious signal 69 to be produced and/or a core dump), but after 70-100 man years of work with Perl, all we had was a mess of gobbledy-gook code that no one understood, and didn't even run.

    Anyway, thanks for your time

    I post anonymously because I'm more interested in the discussion than the karma

  7. My two cents by Anonynous+Coward · · Score: 1

    ...

  8. Python? by DQuinn · · Score: 2

    I've used perl a LOT, and i think it's extremely sweet. AND i appreciate the review of the book since i think i will be getting my little brother into something soon and i _may_ choose perl since he likes the web and such. It would get him plugged into CGI quickly.

    However, i've been hearing more and more about python, so i decided to grab Mark Lutz's book "Programming Python" published by O'Reilly. I'm not too far into it yet, but in a couple of weeks should have chunked through most of it. As a further test to see what's so great about this thing, i'm going to write an OOP app in it (not too sure what it will be yet). Cuz as of this moment i can't see the reason to switch from perl.

    But the question is, would anyone care to have me post a review of this book eventually?

    Cheers,
    DQ

    ------

    perl -e 'print {$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct( 115),10);'}

    --
    os.system("perl -e 'print \"My first Python Script.\"'")
    1. Re:Python? by gorilla · · Score: 3
      The biggest problem I have with python is the syntaxly signifiant indention.

      If you post a perl program on /., it works. If you post a python program on /., it fails.

      Indentation is important for readability, I'd consider a program badly written if it didn't have correct indentatation, but to to make it syntaxly significant is a mistake.

    2. Re:Python? by INT+21h · · Score: 2

      "Programming Python" is a strange beast of a book, not very well suited for a newbie, whether it be to programming as a whole or to Python itself. If you already program in some other language, then the tutorial and library reference (at python.org) is really all you need. As to the absolute beginner... well there's "Learning Python" but I haven't read that one.

      "Programming Python" is the kind of book you peruse over a pot of coffee and with plenty of free time on your hands. Don't expect to read/understand it all in one sitting either.

    3. Re:Python? by DQuinn · · Score: 1

      Thanks for the info. I looked at the docs, the tutorial, lib reference, etc... I found them lacking in a "tie it in together" sort of way. I find that i miss some of the neat subtleties and tricks you can get from a fellow programmer (rather than developer).

      I looked at "learning python" and it was rather jokey :) I mean, i know what a "for" loop is, and i know what OOP is, so that book didn't cover much that i needed.

      "Programming Python" has its drawbacks, for sure. There are already some things i would like to see different. But it has also had some of those "tying in together" kind of things that i wanted. Is it worth the $60+ (CDN)? That remains to be seen. But so far it's not too bad.

      And anyways, my job owes me about 200 hours of "geek improvement time". I know perl, c, c++, shell, blah blah blah... all the unix geek, administrator stuff. So Python is what i'm looking at now. And just as you advised, i've got my coffee, and i've got the time (they're paying me to do this :P)

      Cheers,
      DQ

      --
      os.system("perl -e 'print \"My first Python Script.\"'")
    4. Re:Python? by Anonymous Coward · · Score: 0
      Indentation is important for readability, I'd consider a program badly written if it didn't have correct indentatation, but to to make it syntaxly significant is a mistake.

      The word is syntactically. It's painfully obvious why you have a problem with Python's syntax.

    5. Re:Python? by Zico · · Score: 3

      Can't say I was exactly thrilled with Programming Python. I came into Python already knowing Perl, and just didn't really get anywhere with Programming Python. The continuity just seemed all wrong, out of order, etc. So, I didn't do anything with Python for a couple of years.

      On a whim (meaning one of those times when you're walking around a bookstore with a wad of cash burning a hole in your pocket), I decided to pick up Learning Python. Man, am I glad I did. Yeah, there's a lot of really basic programming stuff in there (which makes it an excellent book for complete newbies), but I found it to be a much better introduction to the Python way of doing things, possibly because it was such a fast read. Once I got the basics down, exploring the more advanced stuff just from the online and included docs was a breeze.

      Stick with giving Python a try, though. You say you know OOP, but if your knowledge comes from using Perl, I think you'll be happy just how easy OOP is with Python in comparison. I like it enough that it's replaced Perl for me as my favorite quick-n-dirty language -- it just "feels" more correct when I'm using it. And yes, I know the degree to which Perl is a "write-only" language depends on the particular programmer, but it's been my experience every single time that when I've had to work with other people's code, the Python stuff was always easier to jump right into than the Perl stuff.

      Anyway, that's just my opinion -- what prompted me to write was that I just purchased "Python and Tkinter Programming" from Manning Publication's website, then came to Slashdot to see a book review featuring a book from the same company. I've never read any of their books before, so am kind of curious.

      Cheers,
      ZicoKnows@hotmail.com

    6. Re:Python? by Richard+Jones · · Score: 2

      Who the hell moderates this stuff? This comment isn't "Insightful", it's bloody flamebait. But then, this is slashdot, and we're all one-eyed Perl programmers around here.

      If you post a python program on /. and it fails, FIX /.

    7. Re:Python? by Anonymous Coward · · Score: 0

      I doubt there will be a review of that book, since it was written in 1996.

  9. Problem with O'Reilly books by slickwillie · · Score: 0

    What I've found with O'Reilly is that they really want to sell you more books. For example, I bought their "HTML Definitive Guide" a few weeks ago trying to figure out how to protect subsequent pages after a user enters their password. Of course, this topic is not covered in that book (some Definitive Guide, huh?). It sort of pointed to their "JavaScript Definitive Guide", so I bought that one yesterday. They only mentioned that topic long enough to say they were not going to cover it.

    1. Re:Problem with O'Reilly books by DQuinn · · Score: 2

      I agree no book (O'Reilly or otherwise) is perfect. But uhh... i have to ask: Why on earth didn't you look in the book(s) to see if it had what you wanted first?

      As geek books go i find that OR books tend to be pretty high up there. They are certainly the ones which are most consistently good. Other books have better information in them that beat one of OR's books from time to time, but there isn't anything out there i've found that can beat them all, or even come close to doing that.

      --
      os.system("perl -e 'print \"My first Python Script.\"'")
    2. Re:Problem with O'Reilly books by vectro · · Score: 1

      If you are referring to http authentication, then it has nothing to do with http... All you have to do is make sure that all the files are in the same Realm... The http spec says that the browser should keep sending the password w/ every request as long as it is in the same realm.

      Read about the format for the .htaccess file, it'll become clear.

    3. Re:Problem with O'Reilly books by slickwillie · · Score: 1

      Finally, someone pointed me in the right direction, after my thinly-veiled troll for information.

      Thanks vectro.

    4. Re:Problem with O'Reilly books by Anonymous Coward · · Score: 0

      That's because authentication is not HTML or JavaScript. You need to read some documentation on HTTP protocols. All you have to do is set up further restrictions in a different realm to acheive what you want.

    5. Re:Problem with O'Reilly books by diskokaiser · · Score: 1

      hmm.... maybe you looked into tho wrong book?!?
      even if the book was the definitive guide, it would not contain anything about protecting pages with passwords, because this has nothing to do with html.
      maybe you are looking for http-authentification, or server-side-scripts? then you should take a look on your webservers documentation or scripting languages like perl or php3. but please dont buy a book before you know what its about and complain about that after this!

      --
      diskokaiser - member of Bunkohr-Audiovisuelle-Produktionsmechanismen-und-L ogistiken
    6. Re:Problem with O'Reilly books by adamsc · · Score: 2

      Given that this isn't something appropriate for either JavaScript or HTML, I'm somehow unsurprised that it wasn't covered.

    7. Re:Problem with O'Reilly books by slickwillie · · Score: 1

      Shouldn't this have been moderated DOWN as being redundant, since it was mentioned numerous times in previous responses?

  10. Perl as A First Language Is Scary by quakeaddict · · Score: 3

    before I start, I would like to thank the reviewer for their time in posting their comments.

    IMHO......

    From a non system-admin point of view...Perl as a first language is scary.

    Thats not to say Perl isn't useful or good, but I would not want to learn about programming by learning Perl as my first language. It has way to many oddities that, if you are interested in programming, don't make the conceptual leap, as it were, to other languages.

    For example, in Perl (like most scripting languages) there is a single data type to represent everything from strings to characters to all sorts of numbers. Java/C++/C/Fortran/Basic etc...have different data types (short, long, char, String etc...) for very good reasons.

    Having someone learn programming via Perl then have them get "more specific" is harder than going in the reverse direction. I can just imagine all these questions from students..."What do you mean there are specific types of variables? "What is strongly typed?" etc....

    Perl also suffers from a syntax problem. Perl has chosen highly compact notation that can scare even the mosty hardy Perl programmer.

    I say learn another language so you can see how Perl has generalized the problem space, not the reverse.

    With these things in mind, I think the usefullness of this book is not as high as one might think.

    --
    I'm still working on a clever footer.
    1. Re:Perl as A First Language Is Scary by GnrcMan · · Score: 2

      For example, in Perl (like most scripting languages) there is a single data type to represent everything from strings to characters to all sorts of
      numbers. Java/C++/C/Fortran/Basic etc...have different data types (short, long, char, String etc...) for very good reasons.


      You make an excellent and very important point. Learning to program with a language as sloppy as perl is probably a BAD idea.
      Perl is great for banging out a script in a couple days, but I always get this dirty feeling when I declare variables in Perl. If you are writing Perl scripts and don't feel kind of weird about variable declarations and use, you probably should pick up a book like "Code Complete" or maybe "Writing Solid Code". (Yes, they're both Microsoft Press, but that doesn't change the fact that they're excellent books.)
      Keep in mind that one of the reasons Perl is so quick and easy is because it doesn't enforce much in the way of good programming practice. That makes it great for quick and dirty solutions, but it also makes it easy for a project to collapse under it's own complexity. And I firmly believe that it's very difficult to unlearn bad programming. Remember, the designers of strongly typed languages weren't just being masochistic. Strong typing can save you from yourself.

      And don't get me started on Perl arrays.

      (stepping down off soapbox)

      --GnrcMan--

    2. Re:Perl as A First Language Is Scary by Matts · · Score: 5

      Before you dismiss Perl altogether as a friendly robust large scale programming language, I seriously recommend a read of Object Oriented Perl by Damian Conway. It's a truly awsome book which just brings together clean programming and perl. Something a lot of people didn't think was possible!

      After reading it I built XML::XPath - an implementation of the XPath spec in perl. It uses lots of classes to do its work, and I feel it's coded very cleanly. And it remains pretty quick (Damian has a discussion of Perl's OO speed issues in the book). If you want to check it out see CPAN. If you don't or can't understand the code I feel I've done something really wrong.

      --

      Matt. Want XML + Apache + Stylesheets? Get AxKit.
    3. Re:Perl as A First Language Is Scary by Cy+Burdock · · Score: 2

      Not to put down perl, but the best first languages have to be Pascal (for it's fully featured implementations of realtime, OO, etc) and, strangely, Visual Basic! However horrible it is, I've seen users create a useful app with this in less than a days reading from a book.

      Getting positive feedback on a relatively structured language is a good thing.

    4. Re:Perl as A First Language Is Scary by Anonymous Coward · · Score: 0
      When you're just starting out, it's important that the development environment be friendly. This disqualifies C. IMHO, it even disqualifies compiled languages like Pascal.

      I'd say that any of the following are decent programming environments for learning. Not one is perfect, but each is good enough. Instead of getting too deep with one language, learn two or three of them.

      Visual Basic is good because it's interactive, and gives you quick results, but the environment can be overwhelming. Using VBA in the context of Excel or Word can be useful.

      Logo is a great intro to functional programming, which everyone should learn. It's a little hard to find, though.

      JavaScript is not great, but everyone has a development environment, and there are plenty of books. It also give you quick rewards.

      HyperTalk and HyperCard are great, and great for learning programming, but only run on Macs (and you have to find it too).

      Frontier for the Mac or NT is an interesting scripting environment suitable for beginners because it's interactive and also lets you actually view the stack and browse the object db with a GUI. The OReilly book for it is useful. Too bad it's a relatively unpopular language.

    5. Re:Perl as A First Language Is Scary by Anonymous Coward · · Score: 1


      For your reference, Damian Conway's book Object Oriented Perl can be found here:

      http://www.manning.com/Conway/index.html

    6. Re:Perl as A First Language Is Scary by Cy+Burdock · · Score: 1

      On the other hand, assembly isn't half bad. Some great insights into how a machine works
      and how to optimise code. This is one of the reasons that are given for not using C++ in
      the Linux kernel - optimising critical areas such as disk access is a lot easier when OO
      isn't interfering.

    7. Re:Perl as A First Language Is Scary by Arien · · Score: 1

      What fully featured implementations of realtime, OO, etc?? The Pascal language does not define any of this. What product are you refering to?

      And as for Visual Basic: Are you talking language or IDE? I think the latter. What about the language? Would people still be able to create the same apps learning how to code ("the old fashioned way") instead of learning to use the IDE?

    8. Re:Perl as A First Language Is Scary by Abigail-II · · Score: 2
      For example, in Perl (like most scripting languages) there is a single data type to represent everything from strings to characters to all sorts of numbers. Java/C++/C/Fortran/Basic etc...have different data types (short, long, char, String etc...) for very good reasons.

      Well, that isn't quite true. Strings and numbers are two different things in Perl. True, you don't see that in the program _text_, but it sure is there behind the scenes. Don't get too excited over the dozen or so numerical types in C. They aren't there to help you write better code - they main reason they are there is to help the compiler generate more efficient code. In C, one can get type "warnings" from the compiler that don't warrant warnings, or not get warnings where you should have gotten one. If you want a language with useful (strong) typing, look at something like ML where the program text doesn't contain any types, but the compilers figures out the types of the variables, and complains when there are conflicts.

      -- Abigail

    9. Re:Perl as A First Language Is Scary by Abigail-II · · Score: 2
      Remember, the designers of strongly typed languages weren't just being masochistic. Strong typing can save you from yourself.

      Care to point out some large coding projects in languages that have strong typing? Don't bother showing anything in C - that isn't strong typing.

      And don't get me started on Perl arrays.

      What about them? At least Perl has arrays, unlike popular languages like C, which just has monsters that try to look like arrays.

      -- Abigail

    10. Re:Perl as A First Language Is Scary by GnrcMan · · Score: 2

      Look, I'm not going to be lured into a pissing contest over which language is better, but I will say a couple things.

      When one talks about strong typing vs weak typing, one isn't referring to an on/off switch. There is a whole spectrum of relative strength. I hope everyone agrees that C is more strongly typed than Perl. I would also submit that C++ is more strongly typed than C. Your first question is meaningless since you are referring to something different than I.

      As far as the second question goes, I'm just going to make this broad statement:
      Perl lacks the structure that I feel is necessary for large scale development projects. I also feel that this lack of structure is an impediment to learning good programming methodology.

      I will say one more thing. I use Perl on a daily basis. I use Perl as often as I use C or C++. I still stand by my statement that Perl isn't a very good language for someone just learning to program. It will take more than trolls to get me to change my mind.

      Casey



      --GnrcMan--

    11. Re:Perl as A First Language Is Scary by Abigail-II · · Score: 2
      Your first question is meaningless since you are referring to something different than I.

      You talked about "strongly typed languages". Not language that are stronger typed than Perl. If you are referring to something different than I am, what do you mean by strongly typed languages then?

      As far as the second question goes, I'm just going to make this broad statement: Perl lacks the structure that I feel is necessary for large scale development projects. I also feel that this lack of structure is an impediment to learning good programming methodology.

      My second question was "What about arrays?" after your remark "don't get me started on Perl arrays". Your broad statement about your experienced lack of structure in Perl doesn't address arrays at all. Hence, it doesn't answer the question, it's just a flamebait.

      It will take more than trolls to get me to change my mind.

      If there's any trolling going on, it's you doing it.

      -- Abigail

  11. Glad to see this! by Anonymous Coward · · Score: 0

    This is an excellent book - I hjust picked it up last month. The section on modular programming is particularly thorough. But how is this News for Nerds or Stuff That Matters?

  12. Confessions of a recent Perl convert by kd5biv · · Score: 1
    Putting aside the (flamebait) arguments that Perl is or is not a good first language, I've seen several people turn to other languages that were less appropriate for their needs (like sysadmins) because of the lack of a good beginner book for Perl.


    I can see why it looks difficult to learn, having just taught myself the basics. However, it's worth learning! Having scalars that aren't strongly typed is a little weird for me, since I came to Perl by the BASIC->Pascal->C route, but after I got used to that and the enormously greater flexibility I have in Perl, I haven't looked back. Two days after I cracked the book, I was doing more with Perl than I've ever done with C.

    IMHO, any entry point that makes it easier to get started in this language is fine by me. The camel book was a bit over my head too when I got started -- it's only started to be really useful to me. (Thanks Randal for Learning Perl, BTW!)
    --


    73 de N5VB (ex-KD5BIV) AR SK
    1. Re:Confessions of a recent Perl convert by Anonymous Coward · · Score: 0

      Did anybody ask your fucking opinion?

  13. Perl by fakeroblimo · · Score: 0

    Perl sucks my rather considerable dick.

  14. This really is funny! Moderate up please. by Anonymous Coward · · Score: 0

    Don Knots guy endorses this post.

    Thank you.

  15. Then what language? by Anonymous Coward · · Score: 0

    I bought the llama book recently, but admittedly don't know how to program at all. What language would be best to start with?

    1. Re:Then what language? by leitchn · · Score: 1

      Something that sticks to the fundamentals of programming, like BASIC, Pascal, Ada, or (maybe) C.

      Even though these languages may not be all that useful now, they're some of the best learning languages, IMO.

    2. Re:Then what language? by crush · · Score: 1

      C

    3. Re:Then what language? by GnrcMan · · Score: 2

      From a strictly academic viewpoint, Pascal enforces excellent programming practice. Unfortunately, it isn't used very much in the real world. As a general purpose starting language, I'd bite the bullet and learn C++. It has it's own set of ideosyncracies, and you have to be careful not to get too gung-ho on classes (It can be easy to get out of hand, for example, the Microsoft Foundation Classes are just plain scary).
      Java has some design flaws (see the January and February 2000 issues of C/C++ user's journal) and you are at the mercy of Sun. Plus I don't care what anyone says...Java is slow.
      With the advent of a standardized C++, it doesn't make much sense to learn straight C right off the bat, and besides, in my experience people who try that end up learning a weird C/C++ hybrid. (ie. the only C++ features they use is streams and the ability to declare variables throughout your code).
      If you learn C++ though, it is important to learn when not to use it. Sometimes plain old procedural C is best. Hell, sometimes Perl is best. VB is very rarely best, and COBOL is never ever best. :)



      --GnrcMan--

    4. Re:Then what language? by Anonymous Coward · · Score: 0

      Java has design flaws compared to C++, according to the C/C++ user's journal? So what? C++ has flaws, according to the Java journals. As to performance, sure, Java is slow for the kind of applications you write in C++. I wouldn't use Java to write an office suite. But I sure as hell wouldn't use C++ for a web application, either. And Java servlets are fast for multithreaded web apps, according to everyone I've heard from who's used them. Blanket statements about which language is best are useless, it depends on your application.

    5. Re:Then what language? by Foaf · · Score: 2
      From a strictly academic viewpoint, Pascal enforces excellent programming practice. Unfortunately, it isn't used very much in the real world. As a general purpose starting language, I'd bite the bullet and learn C++. It has it's own set of ideosyncracies, and you have to be careful not to get too gung-ho on classes Microsoft Foundation Classes are just plain scary).

      I guess another thing to consider,too, is why you're learning to code in the first place.

      If you're completly new to coding, Pascal is a bloody good language to teach you fundamentals: loops, iteration, variables, functions etc.

      Heaps of "learn x in 24 hours" book forget these fundamentals, and I have debugged a shitload of code written by finance geeks that could have been a lot more concise and efficient if they had known the benefits of using functions rather than retyping a whole bunch of code every time they wanted to add a few columns of numbers.

      I'd have to say C++ is a horrible language to learn as a first language. There are sooo many "advancd features" like operator overloading, all sorts of class issues (try explaing friends to someone who just learned the difference between x++ and ++x.

      In fact, even if you're an experienced coder learning OO techniques, C++ can be confusing. I remember my second year at university going from simple little MacPascal programs to C++ on DOS and Unix machines. It put me off coding for a long time.

      I'm not sure what the design flaws in Java are, but it has been pretty easy to pick up for a guy who previously maintained code written in xBase, VB, Delphi and plain ol' procedural C.

      I've also heard Python is a good language to learn good OO techniques.

      I'd say unless you really, really, really need to learn C++, stay away!

      OT:Anyone using Java with MPW on a Mac? Mail me and tell me what you think.

    6. Re:Then what language? by Anonymous Coward · · Score: 0

      Learning C++ right off the bat would be a terrible experience for a brand new programmer. The ideas behind the logic of programming, as well as the basic data structures are hard enough for most. Throwing in the object-orientation part, and you are giving them a big chunk to bite off. I did tutoring for C++ people, and WOW that was tough. Learn pseudocode. learn to translate to basic C commands. learn data structures and algorithms, then OOP. -FLAME BAIT- What can you do with oop anyway that you couldn't do with C procedures and structs? Do you REALLY need re-usable cross-platform compilable code to write hello world? -/FLAME BAIT-

      Just my .02

    7. Re:Then what language? by Anonymous Coward · · Score: 1

      In the hacker-howto, ESR recommends starting with Python. C/C++ are used widely, but they're not a good idea for raw beginners. Avoid Basic and Visual Basic.

    8. Re:Then what language? by graybeard · · Score: 2

      Scheme.

      Imperative languages in general present syntax obstacles that you shouldn't have to deal with. Because of its genesis, perl is the most challenging, but C++'s provenence is nearly as mongrelish. It so happens that the greatest computer text ever, Structure and Interpretation of Computer Programs, by Abelson & Sussman, uses Scheme, but if you don't have a teacher, this book is not for beginners. You might want to check out The Little Lisper or The Little Schemer by Friedman

    9. Re:Then what language? by Anonymous Coward · · Score: 0

      Wow, this is about one of the most pretentious posts I've ever seen....

    10. Re:Then what language? by Zorikin · · Score: 1

      Assembly.

      Huh? No, really. For education. I wouldn't suggest that you just learn assembly and then use that for everything, but if you're enthusiastic about programming, then it's best to start out with the simplest situation, as close to the wire as is reasonable, IMHO (and in Don Knuth's NSHO). You'll understand what is really going on, down to the specific instructions being passed to the processor.

      It's not as if you'll be doing anything that really calls for OO or even block structured techniques. But when you get to that point, won't it be nice to have C to turn to.

    11. Re:Then what language? by Anonymous Coward · · Score: 0
      I bought the llama book recently, but admittedly don't know how to program at all. What language would be best to start with?

      Since you have the courage to admit ignorance, you will go far, grasshopper.

      Algorithms + data structures = programs by Niklaus Wirth. (Prentice-Hall, 1976) is the book you should try to start with. It's sadly very pricey, but should be available at a used book shop near a technical university. It uses a variation of the Pascal language and teaches you how to think about problem solving like a good programmer. From there you can go on to lots of other books and computer languages; it's the thinking that's the important and transferable part of the skills. Choosing the "correct" language is important, but if you can't think in a logical manner, it doesn't matter much.

      The very old joke is "I can write FORTRAN in any language".

    12. Re:Then what language? by GnrcMan · · Score: 2

      Point taken, maybe C++ is a bit complex (I didn't take that route, I went Pascal->C->C++.) What do I know, anyway? :)

      Casey

      --GnrcMan--

    13. Re:Then what language? by GnrcMan · · Score: 2

      As I said above, point taken. I was looking at it from the mindset that you might as well learn everything at once. But looking again, I can see how a learning programmer could get bogged down and frustrated by C++. After all, I learned C first myself* , so what do I know anyway?

      In response to your flamebait: You certainly can use C for just about anything you can use C++ for. However there are many extremely useful constructs in C++ for large scale development. Besides, C++ isn't just about OOP. While that is probably the centerpiece of C++, there are lots and lots of extensions which have nothing to do with OOP.

      * Actually, I learned Pascal first. Moving from the protective womb-like Pascal environment to the cold and uncaring world of C was scary. :) But once you realize what C can do for you, the payoff is enormous.

      --GnrcMan--

    14. Re:Then what language? by GnrcMan · · Score: 1

      C++ has flaws, according to the Java journals.

      Can you give me a reference? I'm really not being obstinate, I have a genuine interest in studying the good and bad points of various languages and I'd be fascinated to read a comparison from a Java expert's perspective.

      And as a side note, I didn't mean to imply that Java is better or worse than C. Far from it. However, I'm reluctant to point a beginner to Java as a learning language.

      --GnrcMan--

    15. Re:Then what language? by platypus · · Score: 1

      Language considerations aside, IMO don't start programming with a luxury ide. Use a simple text editior and write simple command line (i.e. non gui) code. Don't start with visual basic/c.

      Speaking about languages, if you really want to go the easy route, I would also recommend pascal.
      Learn the simple programming structures, then recursion (i.e. towers of hanoi), this clearly helps thinking in algorithms.
      Then perhaps go with c to reuse the structures you have learned in pascal + more advanced/low level concepts of the memory handling etc. .
      Only after that I would try C++/Java/Eiffel to learn more "modern" concepts.

    16. Re:Then what language? by Anonymous Coward · · Score: 0
      I gotta agree with this guy, pretentions and all.

      I still have my photocopied notes for 6.001 from before Sussman's book existed. One of the coolest parts of my MIT experience...

      First impressions are important, oui? Then learn Scheme first and get off on the right foot.

      Scheme has No Syntax on purpose because you're not supposed to worry about it. However (Sussman proves this in the book) you can duplicate any control construct from any other known language using the mechanisms in Scheme.

      Develop a good understanding of (call-with-current-continuation ...) and no computer language will ever intimidate you again!

      So learn Scheme first and think of all other languages as dialects of Lisp! I use C, C++, Java and perl all the time (the right tool for the job...) and it's the only way I can deal with them all effectively.

    17. Re:Then what language? by Anonymous Coward · · Score: 0

      Personally I would not use the complexity of C++ as a reason not to start with it. You can still begin with simple program constructs such as loops, switches, functions, etc. Plus you get the benefit of the more advanced features once you're ready to learn them without having to go learn a new language. (read advanced features as: multiple inheritance, templates, polymorphism through virtual functions, etc.) C++ allows (and even demands at times) a good basic understanding of at least a flat memory model (ie basic pointer operation) that other languages often hide. Of course, if you never want to use them, then fine, but otherwise you may as well learn in a language that has most of the big language constructs. I had some other reasons, but That's all I can remember just now :-)

    18. Re:Then what language? by Gid1 · · Score: 1

      Learning a functional language, such as Haskell, first might be a good plan. We hackers tend to baulk at Haskell, but as a first language, it's surprisingly good.

      One thing to remember is that procedural and object-oriented are only two of the classes of programming language.

      However, learning Haskell for a career in the IT industry is a bit like learning Chinese as a primer for Indo-European languages.

      If I was to recommend anything, I'd say the best way to learn a firm understanding of computing from scratch is to take a really old machine (one of those 8-bit jobs like the BBC Micro or the Commodore ones) and learn the basics on that.

      The assembly on those is easy enough for a child to learn, and teaches you what the computer is doing and how it works. That way, you have implicit understanding of the subtleties of computing.

    19. Re:Then what language? by JonesBoy · · Score: 1

      I was the AC that posted the flame bait before.

      What you are saying now is why I would do c before cpp. You can learn all of the basics with C, and then move onto C++ seamlessly. I think it is better to pick up a language and learn 90% of it before moving on. This way one can see the different powers and ideas that went behind forming the language in the first place. I learned TI BASIC, BASIC, PASCAL, C, x86 assembly, 8051 assembly, scheme, C++, ADA, then PERL, in that order. When I got to perl, I could really appreciate the speed at which it would execute simple scripts, and sometimes not so simple scripts! It is powerful, easy to use, platform independentish, and actually does what you want it to do without having to make a lot of functions that do the "real work" in a program. (String manipulations, data structure overhead, etc.) Most of the time, I just want a program to work and be done with it. Perl is great for that, but a beginner should learn structure, orginization, and form before they get into the lazy programming style. Learning perl as a first language would make a large programming effort spaghetti code that would never run quite right.

      --
      Speeding never killed anyone. Stopping did.
    20. Re:Then what language? by Anonymous Coward · · Score: 0
      Wow, this is about one of the most pretentious posts I've ever seen....

      Rightfully so however. People aspiring to become good professional programmers would be wise to heed graybeard's advise.

  16. Because HTML has nothing to do with password auth by Photon+Ghoul · · Score: 1

    You should know what the language, tool, or technologoy is for before you try to use it. Don't blame Ora on the HTML book not having information about "password protecting". HTML has nothing to do with security.

  17. Fills void but not completely... by NatePWIII · · Score: 1

    I'm looking for a Perl book that already has a bunch of good scripts for log analysis and shopping carts etc... and basically shows you how to implement them. Why re-invent the wheel everytime.


    Nathaniel P. Wilkerson
    NPS Internet Solutions, LLC
    www.npsis.com

    --

    Nathaniel P. Wilkerson
    www.haidacarver.com
    1. Re:Fills void but not completely... by Anonymous Coward · · Score: 0
      Dude,

      Why don't you just check out cgi perl repositories which have free(warez) perl programs that do this?

    2. Re:Fills void but not completely... by (Score:+6) · · Score: 1
      I'm looking for a Perl book that already has a bunch of good scripts for log analysis and shopping carts etc... and basically shows you how to implement them.

      Why? Just start with Learning Perl. If you really want some scripts in dead-tree format, get the Perl Cookbook. For fully functional scripts like the one you mention, get them online, like at CGI Resources.

    3. Re:Fills void but not completely... by gnarphlager · · Score: 1

      Why re-invent the wheel everytime.
      why not? at least that way you know it's YOUR wheel, and if there are any problems you know who to blame. Of course, I'm over ambitious and twice as arrogant ;-)

      --

      Bad things often happen to good people,
      It is up to them to see that they remain good.
  18. We need open source books!! by Anonymous Coward · · Score: 0

    Although paper books have a better UI, you can take them anywhere easily and read them in your bed or upside down...

    This AC thinks we need more books (perhaps in PostScript form) written by volunteers and distributed freely via the net. There are tons of skilled people out there, so maybe they should write a book! Us poor students could save a load of money to put into pizza and alcohol and the like.

  19. Re:Perl is to programming languages... by Anonymous Coward · · Score: 0

    UnrealScript b17ch3z!!!!

  20. Review What?! by Anonymous Coward · · Score: 0

    This guy is a raving lunatic! I don't know what book he read, but the Elements of Programming with Perl that I read was something entirely different.

    This was the bittersweet story of Natalie Portman's coming of age. The beginning of the book, which gave a brief history of Natalie's childhood, evoked long-lost memories of my own growing-up. The chapters describing her 18th birthday made me giggle with joy. The part where she befriended the lubricating midget who was suffering with tourette's syndrome made me cry. Not to mention the sexually charged passages describing Natalie exploring herself while reading posts about herself on slashdot.

    This book has it all. I highly recommend it for anyone wanting to spend time becoming better acquainted with their favorite hot young actress. You won't regret it!

    On the Open Source Hot Young Actress book scale, this one gets 10 gnu-sausages.


    thank you.

  21. Offtopic, skip this... by Remote · · Score: 1

    "...trying to figure out how to protect subsequent pages after a user enters their password."

    Would you please e-mail mail as you figure it out?

    Thanks.

  22. Don't disagree by crush · · Score: 1
    with your main point, but I'd have to take issue with the statement that:

    Perl also suffers from a syntax problem. Perl has chosen highly compact notation that can scare even the mosty hardy Perl programmer.

    I'm assumint that you're referring here mostly to the special variables. You can use the more abbreviated syntax if you like, you can also do things more explicitly and plainly and define everything carefully. It is nice to have a quick'n'dirty when you get used to it though.

    Again, though, I agree with your main point that data-type issue would be possibly bad for a beginner.

  23. Re:Tom Christensen is a fucking asshole. by Anonymous Coward · · Score: 0

    A harsh comment. Anyone unfamiliar with Mr. Christiansen might think it unjustifiably harsh. It isn't, though. sr

  24. Re:Linux? by Zico · · Score: 1

    Of course, if the day ever came that Windows did ship with Perl, we'd hear the usual Slashdot bitching and moaning about those unfair Microsoft bundling tactics.

    You know it's true.

    Cheers,
    ZicoKnows@hotmail.com

  25. Justification. by crush · · Score: 1
    • You'll be able to take the advice of everyone that tells you to "Use the force, read the source" when you ask a question about the Linux kernel.
    • Don't bother with BASIC, it's just as hard to learn from the start and "will give you bad habits"
    • C is widely used
    1. Re:Justification. by qbwiz · · Score: 1

      Modern BASICs aren't that bad, at least not Qbasic(yeah, I know, it's from Microsoft, but it's for DOS), XBasic(it even looks sort of like C), and PowerBasic(all the features of C). It has almost all the features of C, and a little more( string operators). The semi-natural-language operators are also nice( eg. PRINT, INPUT,INSTR (IN STRing)). Apple Basic( and the other early BASICs) are another story....

      --
      Ewige Blumenkraft.
  26. perl-as-language? by indrani · · Score: 1

    Despite being a Perl fanatic (it was, in fact, my first language -- BASIC, shell scripting, and TeX don't count), I have to say I agree that Perl is bad for learning straight-up programming.

    That's why I tend not to think of Perl as an actual language. I think of it as a utility. This sounds counter-intuitive, but let me try and explain:

    Perl was designed by Larry Wall to be as much like natural language as possible, in order to make it easy to learn, useful, and comfortable for _programmers_. Most languages, IMHO, no matter how high-level, are designed to make some aspect of the _computer's_ "mindset" accessible to the programmer, even at the expense of having to jump through mental hoops to do it. A good example is C: C was written to be portable, yes, but it was also written to "get under the hood" of a machine and allow it's users to do low-level things like (heh), write UNIX. Most languages, I've found, are like this: they use things like (as mentioned) datatypes, that force the programmer to think like a computer. It's hard to get used to, but is ultimately a Good Thing.

    Perl, on the other hand, allows a programmer to think like a human, and this is a Good Thing as well, but it IMHO really bars it from being de facto a programming language. It can be used as one, _if you already have the knowledgbe to think like a computer_ -- ie, you understand data types, how memory works, etc, etc, etc, all the things that you pick up in more standard programming languages. Perl makes more sense of you think of it as a meta-utility that can _be_ a language.

    (this probably will sound like complete bollocks an hour from now, but that's what 72 hours with no sleep will do to you...)

  27. Offtopic - Re:Confessions of a recent Perl convert by dillon_rinker · · Score: 2

    Hmmm...

    Perl + convert = Pervert?

    :)

  28. It's because Larry's soooo cool! by fishlet · · Score: 1

    Let's face it folks, the real reason Perl's so popular because Larry Wall is sooo coool. I mean, he's got so many one liners- the mans a walking clint eastwood of the computer world.

    As for the language itself, I find it useful, but I'd rather do most general purpose stuff in Java. Perl's text mangling stuff is very convenient though.

    1. Re:It's because Larry's soooo cool! by Captain+Teflon · · Score: 1

      I use the Camel book regularly and found it invaluable, but IMHO the WORST part of it is Larry Wall's one liners. They are distracting to the extreme, and add whole new shades of meaning to the word "corny".

      Why he couldn't be happy as a successful Uberhacker, and feel he had to try and flop as a comedy writer as well, is beyond me.

      Clint Eastwood? As far as one liners go, more like Peewee Herman.

      --
      Eagles may soar, but weasels don't get sucked into jet engines.
  29. Python books by andy@petdance.com · · Score: 1
    Learning Python is a fine book for learning. Programming Python is far more geared towards being a reference, not unlike the differences between the Camel and the Llama.

    I have to agree that making whitespace significant, even if only in the form of indentation, is a horrible horrible design decision.

    1. Re:Python books by nickm · · Score: 1

      My recommendation is that you get "Internet Programming with Python" and the "Python Essential Reference" by New Riders (another subset of MacMillan).
      The former is a good tutorial for those-who-program, and the latter is a good reference (it's basically some of the python.org references with a ton of rewriting and embellishments and new example code).
      --
      I noticed

      --

      --
      I noticed

      It's getting about time to leave everywhere

    2. Re:Python books by Anonymous Coward · · Score: 1

      Whitespace is also significant in make and we don't hear complaining about that, do we?

    3. Re:Python books by Zorikin · · Score: 1

      Whitespace, meaning \n, is signifigant in your shell:

      echo foo

      is different from

      echo
      foo

      Specifically, one prints "foo", and the other echoes nothing and then tries to execute the file named foo.

      Whitespace characters are characters just like alphanumerics. Is /. "losing" whitespace characters? Or is it censoring them? Stand up for your right to express nothing!

    4. Re:Python books by Anonymous Coward · · Score: 0
      Whitespace is also significant in make and we don't hear complaining about that, do we?

      I'm sure that if you post your phone# here on /. that enough people are more than willing to give you a call and complain about make's stupid syntax. I will be among those people calling.

      There is such a inherent wrongness in making whitespace significant in the way Python and make do that touches one on a genetic level that I cannot come to comprehend that people are actually defending that design decision.

  30. cheaper than thinkgeek by joefission · · Score: 2
    If you go straight to the publisher it's cheaper than at thinkgeek's site. BUT they have other great products!

    Andover's self-referential integrity is still intact.

  31. indenting by MattMann · · Score: 1
    indentation is important for readability, I'd consider a program badly written if it didn't have correct indentatation, but to to make it significant is a mistake

    Why is it a mistake? Why aren't the other programs that can't handle it considered mistakes instead? Seems to me that if I post something it ought to look like I pasted it, and any tools that violate this are broken. And, plenty of perl programs will break when posted anyway. A large subset will work, but by no means all... think about print Seems to me that the answer is: both. I think a language that requires indentation is a good thing, but have the syntax be redundant so that the indentation can be regenerated if it is lost; then build a "beautifier" into the language so it will recreate indented source. Yes, there are different indentation styles, but it's easy enough to get used to any one. My preference is for just following one simple rule: once you open something, everything on succeeding lines of it are indented till it is done. Most people do not indent this way, i.e. function header blocks usually have the curly brace out at the left margin (why?) and closing curlies are usually brought back out to line up with the opening line (why, esp. since that's not where the opening curly is?)

  32. Re:This fills a void but does it cover by pipeb0mb · · Score: 1

    Hmm..

    All this weekend, I have been unfortunate enough to see many pictures of Don Knotts and ulcerated anal cavities (seperated at birth?), that I have been trying to figure out a way to avoid accidentally (read:not paying attention to the URLin the status bar) viewing these 2 atrocities.

    Well, here's my suggestion. Don't allow AC to post HTML. Surely that couldn't be THAT hard to implement...and we wouldn't be subjected to the kind of filth we have seen this past weekend (some would say *months* ).

    I like to view at -1. I frequently like the comments that get blurbled over at a higher setting, but, man oh man.
    That guy with the seriously ill posterior makes we wanna puke. I'm literally afraid to click an URL on SlashDot anymore...



    "Don't try to confuse the issue with half truths and gorilla dust."
    Bill McNeal (Phil Hartman)

  33. Fine way to waste your time by twit · · Score: 3

    That argument doesn't merely apply to books; it applies to all facets of education. If the knowledge is out there, why don't we liberate ourselves to seek it rather than being directed by some obscure authority figure?

    The fact is that this doesn't work. The act of seeking relevant information alone gradually takes more time than absorbing the information itself (as any graduate student can tell you). An instructor, whether at the podium of a lecture hall or at the typewriter, putting together a book, does the initial search for you.

    If your time is worth nothing (and some people's time is worth nothing), then you can spend time working through library catalogues and search engine results. You can gain sufficient experience and knowledge to figure out a subject on your own, but it takes time. Most people, including myself, don't have that luxury; we could all reinvent the wheel, too, but why?

    --

    --

    --
    There is no premature anti-fascism. -Ernest Hemingway
    1. Re:Fine way to waste your time by JackiePatti · · Score: 1

      This argument MAY apply to books - depending on how good the book is and at what level you really want to learn your stuff - cause if you want to be a real expert at anything, you're better off doing the research yoruself to really learn it.

      Also, it depends on where a field is - 8 years ago the web was not only the best place, but pretty much the ONLY place to learn HTML, JAVA and JavaScript.

      But it most certainly does NOT apply to an instructor teaching a course - whom cannot possibly speak as fast as I can read.

    2. Re:Fine way to waste your time by twit · · Score: 2

      That's rather a long stretch. The point of an instructor is to guide you, not necessarily to inform you directly. If you could learn as easily and much faster from a book, you should be reading the book; it's something that you already know.

      It's rare that I've taken a course outside the first-year level that's provided anything more than an outline of the material (although I know of other people who received four years of spoon feeeding); the real work is done as part of readings or associated research.

      --

      --

      --
      There is no premature anti-fascism. -Ernest Hemingway
  34. Tom is an asshole worth tolerating :) by Anonymous Coward · · Score: 0

    Yes, I agree TC is an asshole (sometimes!) After being the target of one of his diatribes, I can attest to that from personal experience.

    However, TC never gets personal and does't have the reputation of a computer-thug like OpenBSD's Theo the Rat.

    I can forgive TC because he's given me and lots of others a lot more in the form of his knowledge and experience than he's taken away by being a hot-headed SOB.

    Just Another Anonymous Coward
    JAAC

    BTW What would you use instead of Perl? Are you falling into the: "I have a hammer, so all the world's problems are NAILS!" mentality?

    1. Re:Tom is an asshole worth tolerating :) by Anonymous Coward · · Score: 0
      BTW What would you use instead of Perl? Are you falling into the: "I have a hammer, so all the world's problems are NAILS!" mentality?

      That would mean he's really getting into Perl. He isn't. He was saying he doesn't like that kind of mentality.

  35. The solution, the /. plugin. by Anonymous Coward · · Score: 0

    /. plugin.
    BTW, what is "filthy" about Don Knots?
    Please, do not be afraid, we will not hurt you.

    Thank you.

  36. Tom C.? Is that you? by drivers · · Score: 1

    Did anybody ask your fucking opinion?

    Tom C.? Is that you?

    1. Re:Tom C.? Is that you? by Anonymous Coward · · Score: 0

      It wasn't Tom. Tom, in an insanely boring ass way that only Tom is capable of, would have written it in Latin. Of course, no one would have been impressed in the least way, save perhaps his mother, if that dumb bitch isn't dead yet.

      Tom, we're all waiting for you to drop dead. do us a favor.

  37. I needed that Kitchen Sink by Camel+Pilot · · Score: 0

    I do not often respond to obvious flame bait, but try adding some reasoning (and examples) to your broad-brush sweeping criticism.

    As a long time C programmer I jumped with joy when I encountered Perl. I found that my personal collection of high-level library functions that I had maintained for years, such as:

    - String manipulation functions.
    - Implicit loop functions such as grep, map.
    - Hashes.
    - Linked lists (dynamic arrays).

    had already been done (and much better) by Larry and put into a package called Perl. Performance was excellent and even exceeded custom C libraries. Not to mention all the software available for reuse such as Socket, POP3, CGI, FTP, TELNET, Date Manip, Image modules.

    I just finished writing a module to communication to industrial data acquisition units (Opto22 Brain Modules) using IEEE 1394 Firewire protocol. The company provided poorly programmed C++ drivers, which I replaced with a Perl Module, building on the excellent IO:Socket module. I completed the driver within 5 working days and achieved a 4 to 1 code reduction. I never needed to drop down to C for any reason, Perl gave me the ability to twiddle bits and even do a big-endian to little-endian byte swap in two lines of code !

    I have found Perl to be an excellent tool in my toolbox and have found many occasions where it was an excellent choice for the problem at hand. Coming from a UNIX background I find it wonderfully designed and intuitive. My hat off to Larry and others for making Perl freely available. To those who have been pissed off by Tom, grow some thicker skin.

    1. Re:I needed that Kitchen Sink by Anonymous Coward · · Score: 0

      I definetely think perl's string parsing ability is supurb, but the implicit loop functions are _HORRIFIC_. Perl has way tooo many ways to do the same damn thing. Those implicit loops are like nearly impossible to read unles you wrote them. They don't even really save any space or time. Its just a waste.

    2. Re:I needed that Kitchen Sink by Anonymous Coward · · Score: 0
      As a long time C programmer I jumped with joy when I encountered Perl.
      ...
      I have found Perl to be an excellent tool in my toolbox and have found many occasions where it was an excellent choice for the problem at hand.

      With these experiences and your mindset you would be wise to investigate more programming languages. Languages from another family than the Algol family. Your Perl programming, actually your programming in general but Perl has borrowed some ideas from the other families, will improve a lot.

      Since you seem to appreciate languages with a lot of functionality already built in you might appreciate Common Lisp.

  38. Tom by Anonymous Coward · · Score: 0

    However, unlike most Perl-detractors, Tom has the coding skills to back up his attitude.

    Back under your bridge, VB-boy!

  39. Re:SLASH moving to Python by joefission · · Score: 1
    Wow, I usually have to read AC posts for that! Nice to see success hasn't gone to Jeff's head. He can post with the best of them :-)

    Of course if this is a slash exploit (not hemos), it's even better !

  40. Consistancy != usefulness by Anonymous Coward · · Score: 0

    Perl is to English as [Python|Java|Scheme] is to Esperanto.

    Esperanto may be a whole lot prettier language, and even more regular (in the mathematical sense) than English - but a whole lot more useful work gets done in English than Esperanto.

    1. Re:Consistancy != usefulness by Anonymous Coward · · Score: 0

      Umm.... What you mean to say is that Perl is to Python as English is to Esperanto. What exactly is the relationship between perl and english? Aren't you trying to examine the relationship between perl and other languages?

  41. Re:Then what language? - LOGO by Anonymous Coward · · Score: 0

    LOGO its not just for kids any more ;-) Really I'm not kiding. LOGO then LISP (very easy transation, just add parens and stir ) Then C or/and asembly then some OO language Eiffel or Java. SB

  42. Perl is virtually useless. by Anonymous Coward · · Score: 0


    All it's good for is writing toy scripts and webmonkey crap. That's fine for Slashdot, but I'm a programmer and it's of no interest to me.

    The natural language analogy is idiotic because these aren't natural languages. You're not talking to people, you're talking to a computer.

    You can spend a month learning C and then spend years learning programming, or you can spend years memorizing arbitrary trivia about Perl and never learn programming at all. It's your perfect right as a free citizen to choose the latter. Since I'm more interested in programming than I am in trivia, and since people pay me to write efficient and maintainable code all day, I've chosen the former.


    Next?

    1. Re:Perl is virtually useless. by Anonymous Coward · · Score: 0

      That's fine for Slashdot, but I'm a programmer and it's of no interest to me.

      A programmer you are not. You are a language bigot and a troll.

  43. Maybe you should look at the table of contents by jslag · · Score: 1

    ...before buying a book

  44. Handspring + ISilo + Perl CDROM Bookshelf by deusx · · Score: 2

    Handspring Visor (TM) + iSilo (TM) + The Perl CD Bookshelf = Perl Hacker's Reference Nirvana

    I carry 6 books with me on Perl, along with the whole bundle of Perl docs that come with Perl itself, on my Handspring Visor with a memory expansion module. It's nice, fairly readable and usable, and searchable. I even read the XS tutorial while in the can. It took some ponderance and reflection, and what a better place to do it? :)

    As for the search engine on the CD-- it's in Java, and I've gotten it working under Linux. IIRC, there are directions in the kit on how to get it working.

    As for books in general, I'm working on getting more and more of them into my Visor, but I still tend to need a physical papery copy of it lying around. Electronic books (at least on the Visor) still haven't gotten the correct user interface details down to replace paper.

    My current companion is DocBook: The Definitive Guide, so that I can be a DocBook XML expert while composing the massive body of documentation for my Open Source project. Try learning a new set of XML tags without flipping rapidly back and forth to see what's valid within what, what attributes are legal where, and what the hell is this?

  45. Re:Tom Christensen is a fucking asshole. by nickm · · Score: 1

    You, sir, are a booby.
    And you belong in the booby-hatch.
    --
    I noticed

    --

    --
    I noticed

    It's getting about time to leave everywhere

  46. Perl does NOT have just one datatype by King+Babar · · Score: 4
    For example, in Perl (like most scripting languages) there is a single data type to represent everything from strings to characters to all sorts of numbers.

    There are many reasons why Perl may or may not be a good first language, but this can't be one of them, since it just isn't true. TCL used to be the textbook example of a language that used the string as its representation for everything, but TCL isn't string only anymore, either.

    Really, I don't know where people get this idea about Perl, which certainly isn't the most typeful language on the block, but is hardly short of interesting types. I suppose it comes from the fact that Perl does provide a lot of automagical operators and conversions (although the fact that conversions are involved should make it clear that Perl has more than one underlying type).

    But one thing I'd like to point out in particular:

    Java/C++/C/Fortran/Basic etc...have different data types (short, long, char, String etc...) for very good reasons.

    Says somebody who clearly hasn't ever had to justify the difference between a short and long to a beginning (or non-)programmer. I would actually argue that the short/long difference is exactly the kind of "people working for the computer" stuff that doesn't belong anywhere near somebody's first exposure to programming.

    If you want to teach the importance of types at the same time you teach programming, you would do better to use a language that has a more interesting and flexible type system; one obvious candidate would be Haskell, or it's interpreted cousin Hugs.

    --

    Babar

    1. Re:Perl does NOT have just one datatype by GnrcMan · · Score: 1

      Perl has only 3 types: Scalars, arrays (of scalars) and hashes (of scalars).

      Want proof? From Programming Perl:
      Perl has three basic data types: scalars, arrays of scalars, and hashes of scalars, also known as associative arrays.

      A scalar encompases anything from a a floating point value to a string. It doesn't matter that there are distinct types under the hood, since from a Perl programmers perspective, there is only the scalar.

      --GnrcMan--

    2. Re:Perl does NOT have just one datatype by mikemulvaney · · Score: 1

      But it does matter, because there are diferent comparison operators: ==(numbers) and eq(strings).

      Mike

    3. Re:Perl does NOT have just one datatype by Abigail-II · · Score: 3
      But it does matter, because there are diferent comparison operators: ==(numbers) and eq(strings)

      No, it doesn't. == and eq are different operators, doing different things. They aren't the same operator giving different answers depending on the type of the operands, like / does in C. == and eq are different, just like + and * are.

      -- Abigail

  47. Can I use Perl to... by Larry_Troll · · Score: 0

    Generate a report based on form input from my website to figure out how many of my visitors have tried my virtual "hot grits down the pants" program???

    --


    "Bad moderator, no karma"
    1. Re:Can I use Perl to... by Hallow · · Score: 1

      Yes. DUH.

  48. Useless like a fox... by Anonymous Coward · · Score: 0

    Strangely enough, people pay me a great deal of money to write highly efficient and vastly maintainable code - in perl.

    But yet, because it is perl and not C or (shudder) Java, it doesn't take ME all day to do it.

    More money for less work... sounds like a pretty good trade to me.

    Say, what are you doing reading Slashdot anyway? Shouldn't you be out tracing down mis-cast pointers, or working out yet another replacement for malloc() or something?

    1. Re:Useless like a fox... by kulturkritik · · Score: 1


      Butthead! There's lots of languages out there that are "safe" (no core dumps, like perl), have automatic memory management (no malloc, like perl), and that most importantly ARE NOT PERL.

      If those are the only reasons you can think of to program in perl, then you are a truly lousy advocate.

      (ps. that last paragraph was a brilliant piece of prose. I aspire to such heights of rhetoric.)

  49. Re:SLASH moving to Python by Anonymous Coward · · Score: 0

    I think it is, there is one from Roblimo above.

    I wonder how they did that, and if they have access to everyone's account like that.

    (posting anonymously, so they won't hijack my account, too...)

  50. The last language by rellort · · Score: 2

    Perl is, without a doubt, the absolute last programming language you'll ever need.

    Give up on pointers -- they're an archaic holdover from assembler. If I have to think about memory addresses, I might as well toggle the program into the front panel in hex.

    Memory management? Don't make me laugh. The only thing that causes more bugs in software than forgetting to free resources is walking into memory you're not supposed to use (see "pointers" above).

    OO is a failure. Sorry, I know this akin to telling some people that God is dead (or that God never existed). It's true and whining won't change it. OO promised code reuse and it never happened. Programmers trying to make reusable classes all went over deadline and were fired. They were replaced by quick-and-dirty hackers who understood that management just wanted to get the darn thing shipped. The only code reuse going on is open source coders who snag each other's routines for their own projects. That's a good thing.

    I'm tired of hearing the "Perl is a scripting language" whiners. At this point, a "scripting" language will do 99% of what needs to be done with a computer. The operating systems are written. The applications are written. All we do now is glue them together to get the data we want. If it's harder than that, you're probably reinventing a wheel.

    "Enterprise systems?" Yeah, right. Most of those enterprise systems are aging COBOL and C driven junkers that should be replaced with multiple x86 boxen running Linux or BSD. They're cheap, reliable, and you can find people to work on them who don't cost an arm and a leg. If you think it takes more than that, you're just wrong.

    --

    -- In the future, everyone will code Perl for 15 minutes. --
    1. Re:The last language by vyesue · · Score: 2

      a. I write reusable code all the time

      b. if you can't keep track of your pointers, maybe you should try an easier line of work (like pumping gas perhaps)

      c. a scripting language will not do 99% of what needs to be done on a computer, and furthermore, what a scripting language _can_ do is usually done at decreased efficiency.

      not an anti-perl rant, just an anti-perl-bigot rant. if you think perl is the only language that has any place in computing, you're obviously not very informed.

    2. Re:The last language by rellort · · Score: 2

      I did not say that I couldn't keep track of my pointers. What I said was that programmers who make mistakes with pointers and memory management create buggy software. If you disagree with that then obviously you are not very well informed.

      Are you seriously telling me that you have never goofed and used an uninitialized pointer or forgot to free allocated memory? If that's the case, I think you should quit programming and consider a career in either water-walking or faith healing. For most mortals, it is a pain.

      Please spare me the "well, we just need better programmers". They aren't out there. When you find them, they cost too much. Most companies aren't looking to hire Alan Cox, Linus, or even vyesue. They want to grab some kid with a couple of years of CompSci undergrad work, pay him a dirt cheap intern's salary, and get him to write their high-traffic web portal. Perl is ideal for this.

      Look at Slashdot, for crying out loud! It's a perfect example of this! Young guys hack together some scripts, make an interactive message site, and collect a few million from the IPO. That's what it's all about, man!

      And, despite your snotty elitist comment, I don't see Rob and Co. pumping gas anywhere but at the self-service pump when their new gas-guzzling SUVs run dry.

      --

      -- In the future, everyone will code Perl for 15 minutes. --
    3. Re:The last language by eric.t.f.bat · · Score: 2
      I'm sick of hearing all this rubbish from hammer users and saw geeks. A screwdriver is all the tool I've ever needed.

      I started, I admit, with a simple little toy hammer, just using it to whack screws into wood. But the problem with hammers is they don't support threaded processing. Using a screwdriver makes things a lot easier. I reckon anyone who would use a hammer or saw or (gods forbid!) a chisel for this sort of thing is just a lame luser.

      I've heard plenty of morons claiming that screwdrivers don't drive nails into walls as well as other tools, but that's bu||$h!+. I've tried using a saw to whack things, and the design flaws are obvious. Stick with a screwdriver and you won't have nearly as much trouble. Or how about the time I tried building a scale model of the USS Enterprise entirely from balsa wood using only a hammer? Fiasco! And yet a screwdriver can install AND de-install screws into wood, metal and plastic with absolute ease of use. Why bother with anything else?

      Lusers.

      : Fruitbat :

      --
      I have discovered a truly remarkable .sig block which this margin is too small to conta
    4. Re:The last language by the+eric+conspiracy · · Score: 1

      Give up on pointers -- they're an archaic holdover from assembler.

      Nonsense. Pointers are crucial to any serious language, including Perl. Without use of pointers (aka references) in Perl you cannot even write efficient subroutines.


    5. Re:The last language by quonsar · · Score: 2

      I'm sick of hearing all this rubbish from hammer users and saw geeks. A screwdriver is all the tool I've ever needed.

      ROFL!!!!!!!!

      [moderator: moderate up when done laughing]

      ======
      "Rex unto my cleeb, and thou shalt have everlasting blort." - Zorp 3:16

    6. Re:The last language by MycoMan · · Score: 1

      As for OO being a failure, I claim that you can pick any language or coding-style and code-reuse is joke. I've worked with many programmers whose idea of code-reuse is that they re-use their OWN code! If they get their hands on someone else's code, they may claim they re-use it but they either get the source code and tweak it (there are a lot of programmers that look at other programmer's code and say "I can do it better than that"), or they don't get the source code and so they write a 'wrapper' around it to convert their API into MY API. How many multiperson programming projects are there out there that are just stuffed with so-called 'wrappers' that basically serve the purpose of converting somebody else's interface into MY paradigm? I think there's a lot of them. The fact that OO lets you inherit someone else's object just so you can 'enhance/extend/modify' it is just a fancy way of saying that you'll re-use code just as long as you get to turn it into your own code.

    7. Re:The last language by Panelvan · · Score: 1

      EtFB? Mein Gott! AICSA is EVERYWHERE! Aieeeeee! On Topic: I'm probably going to get a copy. You can't get too much documentation, though I can also reccomend the following links: http://netizen.com.au/services/training/modules/pe rlintro/materials.html http://netizen.com.au/services/training/modules/pe rlinter/materials.html http://netizen.com.au/services/training/modules/pe rlcgi/materials.html

      --
      -- Post No Gravy
    8. Re:The last language by Abigail-II · · Score: 2
      Pointers are crucial to any serious language, including Perl. Without use of pointers (aka references) in Perl

      You missed the point completely. It isn't pointers aka references. A reference isn't a pointer, and a pointer isn't a reference. You can't point a reference to anywhere you want - it always has to reference something. You can't do pointer arithmetic - after all, a reference isn't a pointer. You can't segfault while dereferencing a reference - it always lead somewhere safe.

      References aren't pointers.

      -- Abigail

  51. Efficient, my ass. by Anonymous Coward · · Score: 0


    It's an interpreted language.

    Do you write OS kernels with it? Text editors? Language interpreters? Compilers? Do you write anything that can't be cobbled together by gluing together modules that a competent programmer wrote in C or C++? Can you do proper OOP with it, or does it just have a fake toy "class" thing like Visual Basic has?

    Please, don't be ridiculous. Perl zealots sound exactly like VB zealots, and for the same reasons: It's a blunt instrument. It looks "powerful" to them, but that's because they just don't get it.

    And you're simply inventing the maintainability thing.


  52. What should a learner's language be like? by rgmoore · · Score: 2

    Thats not to say Perl isn't useful or good, but I would not want to learn about programming by learning Perl as my first language. It has way to many oddities that, if you are interested in programming, don't make the conceptual leap, as it were, to other languages.

    Well, Perl has some advantages and disadvantages as a learning programing language. I definitely agree that its lack of strong typing and quirky handling of nested data structures are things that I wouldn't want to force a beginning programer to learn. OTOH, I think that some of its other features, like being interpreted, having localizable variable, and having easy file handling, are things that are desirable for a learner.

    What might be interesting is a list of features that should be in a language for beginners. Everyone seems to complain about the things that various languages do wrong or don't include, but it might be nice to have a list of things that should be included. My modest attempt at this:

    • Declared variables: having variables pop into existence when mentioned is a big source of bugs. Even Perl seems to accept this, which is a big reason that everyone is encouraged to run under strict at all times.
    • Some typing: At the very least numbers and strings should be kept separate, even if there's no int/float distinction. The complex rules about casting strings to numbers in Perl are more confusing to a learner than requiring separate types would be.
    • Interpreted: I find that interpreted languages are much easier to debug than compiled ones, and a learning programer probably cares more about that than the speed of a compiled language. If you really want, you could have some sort of compiler, too.
    • Strong support for subroutines: Any good language has this.
    • Good commenting: It's never too easy to learn how to do in code documentation.
    • Good libraries: This should help a beginner to write more significant and satisfying programs. If the source is included, as it should be in an interpreted language, they can also provide a good style guide.

    Any other ideas for what a language should have?

    --

    There's no point in questioning authority if you aren't going to listen to the answers.

    1. Re:What should a learner's language be like? by Abigail-II · · Score: 2
      Well, Perl has some advantages and disadvantages as a learning programing language. I definitely agree that its lack of strong typing and quirky handling of nested data structures are things that I wouldn't want to force a beginning programer to learn. OTOH, I think that some of its other features, like being interpreted, having localizable variable, and having easy file handling, are things that are desirable for a learner.

      Well, Perl has no strong typing, but languages that do have strong typing aren't very popular as first languages either. And no, C or Python don't have strong typing either. Haskell and ML do though. I fail to see what is "quirky" about Perls handling of nested data structures. It behaves similary to Python, and it sure beats the crap out of C. I don't think beginners have any interest about whether languages are interpreted or compiled - not that Perl is interpreted; Perl gets compiled before it's executed. Proper use of local is one of the harder things to learn in Perl, if I were to teach beginners, I wouldn't tell them about local untill they are past the beginning stage.

      Some typing: At the very least numbers and strings should be kept separate, even if there's no int/float distinction. The complex rules about casting strings to numbers in Perl are more confusing to a learner than requiring separate types would be.

      Why? What's so special about having different types for strings and numbers? With warnings turned on, Perl will warn you if try to add "foo" to "bar", so it isn't that you can easily make errors. OTOH, you don't have to teach newbies about horrid functions like sscanf, or bother them with a battery of functions that do nothing than take a value, and return the same value, but as a different type. (atoi, atof, etc).

      Interpreted: I find that interpreted languages are much easier to debug than compiled ones, and a learning programer probably cares more about that than the speed of a compiled language.

      Really? What's the benefit of an interpreted language over a compiled one? I can see the benefit of not having a separate compile stage, like C or Pascal have, but Perl is compiled before executed.

      Good commenting: It's never too easy to learn how to do in code documentation.

      That's not a language feature, but a feature of programs.

      Good libraries: This should help a beginner to write more significant and satisfying programs. If the source is included, as it should be in an interpreted language, they can also provide a good style guide.

      Core libraries are typically optimized for speed. I don't think providing a style guide for newbies should be a primary task for something like libc or libm.

      Any other ideas for what a language should have?

      • Not really a language feature, but more a compiler one: good error and warning message. (This is my biggest hesitation to suggest Python as a good first language, its error messages are very cryptical)
      • Memory management, both in the sense of garbage collection, automatic allocation and range checking. Thirty years (and counting) of security holes due to buffer overflows in C programs show that the price of range checking is well worth it.
      • The language should serve the programmer, instead of the programmer be a slave of the language. With C, you have to tell the compiler everything: this is a number, and it will not have a sign, and reserve at least 2 bytes for it. And just do something undefined when the programmer uses it as a pointer anyway. Either do it the Perl way, where the value determines the type of the variable, or the way certain functional languages do it: deduce the types of variables from the way they are used, and abort compilation when there's a conflict.
      • Compact syntax. If things tend to be done often, it isn't a sin to have a special language construct to do this, even if it makes the language bigger. That's the way natural languages work as well. This includes doing things automatically, like allocation of space. That way, important fragments of code don't get cluttered with trivial code, making code much more readable. Take this piece of Perl code, and write a C equivalent:
        my%words;
        while(<>){
        foreachmy$word(split'')&nb sp;{
        $words{$word}++
        }
        }

        foreachmy$word(sortkeys%words){
        print"$word:$words{$word}\n"
        }
      • Invariants. You should be able to set restrictions on the values of variables, which are checked on a regular basis (like the end of method call, or when parameters are passed in to a function). Eiffel has this. Of course, you can do this by hand, but that clutters your code, and makes it harder to change the conditions.

      -- Abigail

  53. Can you back that up? by Anonymous Coward · · Score: 0
    If true, it seems strange that the 2nd highest Perl position posted at RealRates is only $110/hr. The highest, $300/hr, is clearly a statistically irrelevant anomally.

    I'm earning $85/hr corp to corp for writing Perl scripts, Sybase stored procedures, and Sybase triggers in the New York financial industry. The Sybase is the reason my rate is this high, not the Perl.

    1. Re:Can you back that up? by hotfries · · Score: 1

      I have several contracts at $125/hr for Apache/mod_perl Web development.

  54. What's the best thing about C? by hey! · · Score: 4

    The best thing about C is that almost anybody with any sense teaching or learning C uses K&R. Beginners consciously or unconsciously absorb a standard style and approach to common programming problems that are within the purview of the language.

    What's the worst thing about Perl? The biggest complaint I hear is that Perl is cryptic; however I think this is bit of a bum rap. It isn't hard to make C programs that rival the worst Perl examples. Also, I've found some largish Perl systems that were a breeze to maintain, very clear and well organized.

    I think a lot of this complaint really can be traced to the Camel book, which while generally admirable and clear in its explanations is a bit too hung up on the Perl motto: "There's more than one way to do it". It is an interesting, and perhaps essential element of the Perl philosophy (I haven't decided which), but unfortunately every new Perl programmer who uses the Camel book to learn makes up his own idioms, and they don't always choose well.

    I'd be interested in the consistency and quality of the Perl style in the book. It may be time for an "elements of Perl style" handbook.


    --
    Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
  55. Here is a solution by Anonymous Coward · · Score: 0

    OpenDK

    Thank you.

  56. You are the ... by Camel+Pilot · · Score: 1

    It's an interpreted language.

    True, but a very efficient interperted language. Somewere I have link to a study done by Kernahan (spelling ?) comparing perl performance to C, C++, Java and others. For some operations Perl even bested C++ and C and almost always bested Java. Yes, I know Java performance has increased significantly lately.

    Do you write OS kernels with it? Text editors? Language interpreters? Compilers?

    No, and nobody has suggested such, that is why Perl itself is written in C.

    Do you write anything that can't be cobbled together by gluing together modules that a competent programmer wrote in C or C++?

    Yes, all the time. In fact, one could consider Perl as a gluing of C modules for use at a higher level.

    Can you do proper OOP with it, or does it just have a fake toy "class" thing like Visual Basic has?

    I suppose that depends on your definition on "Proper" OOP. Check out CPAN which is probably the largest collection of freely reusable source code in existance. Remember one the primary objectives if OOP is software reuse. On that account Perl delivers.

    And rememeber few "Perl Zealots" recommend Perl for everything. They are Zealots because that for a sizeable portion of the problems they encounter in their programming careers, they find Perl to be an appropiate tool.

    Try educating yourself before making an Ass out of yourself.

    1. Re:You are the ... by Anonymous Coward · · Score: 0


      Can you do proper OOP with it, or does it just have a fake toy "class" thing like Visual Basic has?

      I suppose that depends on your definition on "Proper" OOP. Check out CPAN which is probably the largest collection of freely reusable source code in existance. Remember one the primary objectives if OOP is software reuse. On that account Perl delivers.


      You're kidding. I thought Perl had at least some kind of OOP support. You're saying it has none at all? Not a trace? Holy shit. I'm assuming that that's what you mean because if you had a valid positive answer to the question, you'd've provided it. The fact that the community has accomplished one of several OOP goals in a limited and non-OOP way, is kind of, well, totally fucking irrelevant.

      I'm interested in whether Perl supports abstraction, for example. If you don't know what that is, or what OOP is, that's okay. A lot of people don't, especially people who work with primitive languages like Perl that don't support it. That doesn't make you a bad person at all, nor a dumb or foolish one. What makes you dumb and foolish is trying to lie your way out of giving an honest answer to a question you don't understand.


      Do you write anything that can't be cobbled together by gluing together modules that a competent programmer wrote in C or C++?

      Yes, all the time. In fact, one could consider Perl as a gluing of C modules for use at a higher level.


      Which? I implied that Perl "programmers" spend their lives writing trivail scripts that glue together modules containing real code that somebody else wrote. I implied this by asking you if you ever did anything but that. You replied by saying "yes" (presumably in response to my question), and then turning around and agreeing with me: "In fact, one could consider Perl as a gluing of C modules for use at a higher level." Damn right "one could". One (me, for example) does. Isn't that what this argument is about?


      And rememeber few "Perl Zealots" recommend Perl for everything. They are Zealots because that for a sizeable portion of the problems they encounter in their programming careers, they find Perl to be an appropiate tool.

      This is because those are the people who spend their "programming" "careers" writing trivial toys. Sysadmins, mostly. I have never heard of a professional programmer who had any patience with Perl. Not one. Ever. It's a sysadmin toy, and a damned useful one if there's no need to maintain the code, but that's all it is and all it was ever meant to be.


    2. Re:You are the ... by Camel+Pilot · · Score: 1

      O.K. Sorry for being too general. Yes, Perl supports most OOP constructs and Paradigms. If you take the time to look Perl supports data encapsulation, polymorphism, inheritance, etc. There are difference in its support for OOP versus C++ or Java. Perl does not force you one way or another, but lets the programmer decide on the best approach.

      The fact that the community has accomplished one of several OOP goals in a limited and non-OOP way, is kind of, well, totally fucking irrelevant.

      Limited is your uninformed judgement and not the term I would use and it is not irrelevant. BTW, most of the modules on CPAN are written with a OO interface. Is OOP just an end or a means to an end.

      As far as writting "real" code with Perl. Yes, I have been involved in several significant projects using Perl that was not cobbling together "real" C code. I have used Perl to replace "real" C++ code (Firewire driver) as was mentioned in a previous post in this thread. I have used Perl to develop several data acquistion systems and monitoring system complete with a browser based operator interface. I have implemented several custom e-commerce sites, FAQ generators, web based document logs, etc.

      Could these have been done in C or C++ ? Sure at a much greater cost. Are they maintainable ? Yes. Maintainability is more a matter of design, style, and skill then a side-effect of a language or even a design approach (OO versus or non-OO).

      Other people using Perl ? Well lets see I guess we are posting to one. Please point me to the Java or C++ equivalent. But, I am sure you consider this to be trival toy script.

    3. Re:You are the ... by Anonymous Coward · · Score: 0
      And rememeber few "Perl Zealots" recommend Perl for everything. They are Zealots because that for a sizeable portion of the problems they encounter in their programming careers, they find Perl to be an appropiate tool.

      This is because those are the people who spend their "programming" "careers" writing trivial toys. Sysadmins, mostly. I have never heard of a professional programmer who had any patience with Perl. Not one. Ever. It's a sysadmin toy, and a damned useful one if there's no need to maintain the code, but that's all it is and all it was ever meant to be.

      As a professional software engineer I use whatever language is most suitable to my current task. In most cases this is C/C++, but Perl (like VBScript) has its uses; and well written Perl is just as readable as well written C.
      When a person likes/dislikes a certain programming language (which is merely a means to an end) it suggests that such a person is neither a 'professional' nor a 'programmer'.

    4. Re:You are the ... by Anonymous Coward · · Score: 0
      When a person likes/dislikes a certain programming language (which is merely a means to an end) it suggests that such a person is neither a 'professional' nor a 'programmer'.

      I'm sorry, but that's bull. A professional programmer can have very good reasons to like or dislike a programming language. When some makes the usual rulez/sucks sweeping remarks, then he is most certainly not presenting himself as a professional programmer.

      There can be various reasons why someone could like a programming language. Perhaps it was designed by people who think the same way about programs and programming languages as the programmer? Take for example the Lisp approach of adapting the language to your problem, instead of the problem to your language as is common in the C/C++ world.

      Perhaps a programming language has good support from a vendor or on a certain platform (getting itchy already people? ;-). What's unprofessional about choosing the proper language because of good support for a certain solution and liking it because of that? Ofcourse, it would be unprofessional into the extreme to always push a certain language just because you like it.

  57. OOP has its place. Take a look at Eiffel by Anonymous Coward · · Score: 0
    OOP wasn't designed to write "Hello, World". It is, however, great for those of us writing large systems with complex interrelationships.

    You are certainly correct about C++, which is the perfect language for meeting its goals. Of course, those goals, C compatibility and shielding programs from effects of features they don't use (see Soustrup, I believe the title is Design and Evolution of C++, have little to do with life cycle effectiveness.

    Java is cleaner, but basically combines the elegant simplicity of C++ with the blinding speed of Smalltalk. (I am a Sun Certified Java Programmer.)

    For a really clean first language and nice first book, check out Switzer's Introduction to Eiffel. The GNU Eiffel compiler runs from the command line and generates good code. A spiffy commercial object oriented interactive development environment is also downloadable. Eiffel makes life complicated for the compiler, not the programmer.

  58. Insightful by GnrcMan · · Score: 3

    Perl zealots sound exactly like VB zealots, and for the same reasons: It's a blunt instrument. It looks "powerful" to them,
    but that's because they just don't get it.


    That is a very insightful statement(ignoring the surrounding flamebait). Gung-ho Perl programmers do have the same mentality and viewpoint as VB programmers.
    But the reason Perl is so quick is the same reason that VB is so quick. They both let you get away with almost anything. While this is fine for small scripting solutions, it breaks down as your application becomes more complex.
    Perl is useful, but only for small scripting problems. As your problem grows, Perl becomes less and less useful and no amount of burying your head in the sand will change that.

    One of the most important and valuable skills a developer can have is knowing what tools to use for what job. I use Perl to bang out a simple script in a day or two. For anything more complicated I use C or C++.

    --GnrcMan--

    1. Re:Insightful by MrDarkguy · · Score: 1

      On behalf of the entire Perl community, HEY! Watch the sweeping generalities there!

      Believe me, speaking as a professional developer, for any project, you have to pick the right tool for the job. I love working in Perl, but that doesn't mean that it's the best language in all situations. Projects for which I choose Perl generally have the following requirements:

      1. Large amounts of string manipulation: I can beat my head against C/C++/Java/etc or I can just buckle down, and s/// my way to textual nirvana.
      Especially when I have to work with databases. DBI is very nice to work with.

      2. Speed is not a primary design requirement: Hey, Perl can't compete with a properly optimized bit of C/C++ code. Not to mention that there are cases where speed-critical code can be written in C and linked into your perl script using XS. It's a hell of a lot easier than JNI!

      3. It's a simple task that I don't want to spend a lot of time on: Sometimes you need quick and dirty. If I have to do a one-time-only parse report for a client, I can whip it out in an hour with Perl, or slog it out with C...Hrmmmm...tough choice.

      But, for large projects (applications) with more than trivial UIs, I'll choose C/C++ more often than not. The most important part about mastering Perl is learning when it's not apropriate to use Perl.

      --
      "What do you mean, invalid parameters? 9000Gigs of RAM and it can't answer a simple question!" -- Earthworm Jim
    2. Re:Insightful by GnrcMan · · Score: 1

      Sorry, you're right. Most Perl programmers I've run into are level headed people smart enough to know when a language like Perl can save them a lot of grief. I was refering to the "other" Perl programmers. Lots of C programmers have the same ridiculous bone-headedness.

      --GnrcMan--

  59. whitespace requirements for make by Anonymous Coward · · Score: 0

    Maybe you don't hear the complaints, but I've heard people bitching about losing time and getting extremely frustrated debugging makefile's that contained blanks instead of tabs. Who would expect to be nailed by cut and paste when the copy looks identical to the source?

  60. Yea, funny, but seriously... by Anonymous Coward · · Score: 0

    Seriously, OpenDK made EZ runs circles around this.

    1. Re:Yea, funny, but seriously... by Anonymous Coward · · Score: 0

      You need a new graphic. That one is so old. Do you not change your underpants, either?

    2. Re:Yea, funny, but seriously... by Anonymous Coward · · Score: 0

      not until the grits cool to the temprature of the supple marble that has replaced Natalie Portman's naked body

      Thank you.

  61. re: abstraction by kulturkritik · · Score: 1


    I agree with you mostly, but that's a lame argument: every programming language that supports functions supports abstraction. The idea is not something that any particular languages can "support"; it's above that, and nothing to do with OO programming.

  62. Make's syntax is dumb by baxissimo · · Score: 1
    Whitespace is also significant in make and we don't hear complaining about that, do we?

    You must be deaf, then. I hear people complaining about make's goofy tab syntax all the time. Most people get over it, but just about everyone I know was bit by it at least once when they were starting out, and no doubt muttered under their breath (like I did) "what a dumb syntax".

  63. offtopic: which is better? by kulturkritik · · Score: 1


    Code Complete or Writing Solid Code?

    Or rather, which would you recommend?

    1. Re:offtopic: which is better? by GnrcMan · · Score: 1

      I actually like Code Complete better. Written by Steve McConnell, who is a veritable font of programming wisdom for both developers in the trenches and project managers. Though both books are well worth it.

      --GnrcMan--

  64. Re:Object Oriented Perl by GnrcMan · · Score: 2

    Does Perl support OOP?

    Yes and no. How's that for a lame answer. Let me expand.

    Perl cheats. Take this exerpt, straight from Programming Perl:
    * An object is simply a referenced thingy that happens to know which class it belongs to.
    * A class is simply a package that happens to provide methods to deal with objects.
    * A method is simply a subroutine that expects an object reference as it's first arguement.


    What they appear to have done is tack on some features which, when added to your regular old subs in your regular old packages, auto-magically turn the package into a class. Inheritance is barely supported. (There's an array called @ISA which has a list of packages to look in for "methods").

    To be honest it seems very kludgy to me. It almost appears as a way for procedural programmers to get that warm and fuzzy object oriented feeling without actually doing it properly.
    By way of truthfullness in advertising, I'm not terribly familiar with the OO features of Perl, but to my untrained eye, it's somewhat akin to a C programer adding functions to their structs so they've got packaged functions but can still access the data members freely. Sure, you've got an object, but you're missing the point.


    --GnrcMan--

  65. Website 'Stalker'...All Please Comment by Anonymous Coward · · Score: 1

    (completely off-topic, btw)

    Just an anonymous note to state the obvious that Slashdot is under 'attack' by a techno-dweeb with a chip on his/her/it's shoulder. It's clearly the same person who kept railing on about Slashdot's not releasing the Slash code and whatnot. The person has managed to generate postings in Hemos' and Roblimo's names, which is interesting and a good bit of bug-finding if not a bit alarming and annoying. Other attacks consist of posting spurious topical links that lead to porn/whatever links and the repeated posting of a morbidly descriptive bunny mutilation. Posts are fed in in amounts intended (successfully) to make moderating them all down practically impossible.

    This was bound to happen eventually, as a site this prominent, like a movie star, is bound to provoke the ire of a demented soul somewhere who then proceeds to stalk and harass the object of their obsession. It's sad and all that one single numb-nut can cast such a shadow upon something otherwise benigh, but such is life.

    Slashdot will respond creatively, I am sure. Till then, take EVERYTHING you read here with a big grain of salt. Expect fairly dreadful porn links and provokative racist bits as par for the course.

    Cheers.


    MODERATORS - in cases where a story is 'flooded' with bogus posts (gritz and other nonsense), try posting the good articles UP rather than the bad ones down. If an article is already up to '3' or something, leave it alone and bring up some others to help the good/normal posts to rise above the bs. Just an idea.

    I imagine a story will appear soon addressing this issue

    1. Re:Website 'Stalker'...All Please Comment by kuro5hin · · Score: 2
      It's clearly the same person who kept railing on about Slashdot's not releasing the Slash code and whatnot.

      There were several people complaining about this. I was one of them, but it's not me doing the attacking. For the record, I'm thrilled that the code's out, and have no further problem with slashdot or it's management.

      You're right though that /. appears to be suffering what amounts to a DOS attack, in the comments. Maybe we could rename it a "Denial of Signal" attack.

      My only suggestion for this is that basically, totally anonymous posting should go. Here's how I would do that:

      • To post a comment, you must have a user account and be logged in.
      • You MAY choose to post your comment anonymously. The system will know who you are, but your name will not be associated publicly with your post.
      • User accounts must be confirmed via email before being activated. That is, you sign up, /. sends you a "confirm" mail, and you return it to activate the account.
      • Accounts may be disabled by admins because of abuse of the comment system, which constitutes a DOS atack, as I mentioned above.
      The overall effect of this is that it would be much more difficult to automate the slashdot-bombing procedure, as you'd have to create a new email account and user account every time you got booted. I think this would kill about 90% of the worst crap posted here.

      Note that I'm talking about the long pasted-in text posts, and the really just useless crap. Some of the trolls are amusing, and I don't think they'd get all get booted.

      As for the user account hijacking problem, I assume there are some security issues with the slash code. Bummer.

      Wish you could moderate the submission queue?

      --
      There is no K5 cabal.
      I am not the real rusty.
    2. Re:Website 'Stalker'...All Please Comment by Abigail-II · · Score: 2
      The overall effect of this is that it would be much more difficult to automate the slashdot-bombing procedure, as you'd have to create a new email account and user account every time you got booted. I think this would kill about 90% of the worst crap posted here.

      Not sure what this discussion has to do with the subject of the story (and, in that sense, it's as much a DoS as the "attack" the posters are complaining about), but the above is hardly a hindrance. It wouldn't take a halfway decent coder more than an hour to write a Perl or Python program that creates a new email account on one of the many free email services out there, and a new account on slashdot. Let the account generator run overnight, and you have quite a few accounts you can (mis)use.

      I would say, let's keep the "Anonymous Coward", but add an "AC" filter, regardless of your comment level. A filter like "show me only comments of people having positive karma, have made at least 10 comments, and have been around for at least 4 weeks" would be useful.

      -- Abigail

  66. This one is online and free by Anonymous Coward · · Score: 0

    Perls of DK

    Thank you.

  67. Re:Object Oriented Perl by eric.t.f.bat · · Score: 1
    I'm not so sure that data hiding is all that important. I program object-orientedly (sorry) just about all the time, by:

    • Minimizing small blobs of global data, but instead putting things into record/struct/hash structures.
    • Bunching procedures together, whether or not the syntax allows it, to make it clear that they operate on a particular object.
    • Inheriting, whether through IS-A or HAS-A relationships. Making every procedure generic enough to be useful outside the original designed domain. This is what I mean by code re-use.
    • Applying a reasonable amount of discipline regardless of what the language allows.
    That's what makes my programs Object Oriented.

    : Fruitbat :

    --
    I have discovered a truly remarkable .sig block which this margin is too small to conta
  68. Re:Offtopic - Re:Confessions of a recent Perl conv by Anonymous Coward · · Score: 0

    elle est bonne :-))))

    This one is very, very funny Mr dillon rinker or LOL as you use to say sometimes.

    I was laughing when i read your comment, previous where so serious...

    But anyway, for my first visit (browsing the net) here, i think that this 'forum' is nice !

    and it's seems that there are smart guys around there ...humm . I'll try to learn perl indeed !


    GeeBee From France

  69. mais oui (Re:Can you back that up?) by inah · · Score: 1
    this is an old thread in c.l.p.m
    old thread at deja

    the math comes to this gentleman, assuming 8 hrs a day, biling at a rate of $250/hr. so oops, i underestimated! of course, he is not your run of the mill programmer.

    my fiance had an offer two months ago for a position in SF for a 280k annual salary at a startup. and yes, it was for Perl. that comes to ~140/hour, but self employment (incorporating, etc) and salaried bases can have very differenct meanings to net income.

  70. "Allows" != "Supports" by Anonymous Coward · · Score: 0


    Should I have said "data abstraction"? Should I have mentioned type safety? Is there any way in C you can do anything analagous to overrideing a virtual function, without throwing function pointers around by hand? Say for example I have a base class, foo, and from foo I derive bar and baz, each of which has very different guts, but the same interface . . . This is often extremely handy. You can do something like that in C, but you've got to implement a lot of things by hand that C++ does automagically, and it's bound to be less efficient because you don't get static type-checking on concepts that the designers of the language didn't anticipate. You'd be stuck with type fields or other ugliness. Yeah, you can do it. The Win32 API does it. Windows [as a general noun, I mean] in Windows (C)(TM) are conceptually rather similar to "classes" in C++, and it's all done in C. But it's ugly. I really love C; it's a cleaner and more elegant language than C++. But C++ has all these goodies . . . :( Everything's a compromise.


  71. perl and the x86, the ugly evolution of a silicone by maraist · · Score: 2

    First, It amazes me the maturity level one finds on public discussion boards. I am very grateful for the moderation system, so that, in general, I
    do not have to be subjected to this. But on topics such as this, I feel compelled to actually read everything. How people's opinion of Tom
    Christianson relates to this escapes me. He has contributed considerable intelligent information that can only help the Open Source community.
    I'd like to present the idea of evolution, if I may. A man evolves by growing more nimble fingers, a larger brain with greater capacity for
    memory, problem solving, etc. He evolves by being able to withstand harsh cold ( or hot ) environments. Often times, man finds himself with
    strange and seemingly useless biology: An appendix, toes, back hair, various skin tones and shapes, etc. Life, on the other hand, evolves
    through natural selection of species. When one species can no longer adapt ( analogously finding a local minima that they can not surmount ), it
    is replaced by others.
    The same holds true for our silicone world. A technology is created. The environment changes, and the technology must adapt or die. Death
    involves reinventing the wheel with our new life form; starting from scratch on the technical design, AND convincing a target audience to
    support the new technology. Thus, just like in nature, the predisposition of a technology to adapt is greater than it is to die off and be replaced by
    something new.
    As a case example, take Intel's x86 ISA. A venerable and intelligently adapted system. Sure, the original draft of x86 didn't take into account
    32 bit memory, pipelining, n-way parallel instruction execution, etc. Yet that same language has been adapted to systems today that are among
    the fastest and cheapest in the world. This of course, was not to the merit of the appauling instruction set, but to the adaptiveness / inventiveness
    of their designers who knew how to maintain their market. Before shreding the idea of the x86 ISA, try, yourself, to invent a hardware language
    today that can cleanly adapt to technologies 10 years from now. ( neural message passing systems possibly? ) It's really hard to do. The only
    real way is to have enough of an influence to periodically reinvent yourself in an incompatible way ( as Apple or SUN was able to do. Though
    their lack of a perfectly competative market reduces their value to the computing society as a whole. )
    Perl, likewise could not have have forseen all the uses that it has today ( and therefore produced a language suitable for everything ). Written
    first as a scripting language, then later as a full general purpose language. Never being fully without bugs, constantly reinventing itself, yet
    keeping backward compatibility as best possible. Still later, we add certain modern programming techniques ( again without breaking
    compatibility ) such as OOP, and threading. Threading isn't fully stable, and many important packages ( such as DBI ) warn against using it,
    while OOP is something of a perversion of classical approach. It is difficult and inconvinient to consistently define class objects. When dealing
    with OO, I much prefer java ( and to some small degree, Python ) since these were created after the OO revolution ( or skirmish, if you prefer ).
    Still, perl seemed better apt to handle these two revolutions than C ( which isn't pleasent for writing threading code, and had to be mangled in
    order to handle OOP ). Without breaking backward [symantic] compatibility, perl has managed to encorporate many exciting modern features.
    It's nature has even allowed it to adapt to web server-side embedded scripting ( in the form of ePerl, embPerl, mason, etc ).
    My focus is not that perl has conqured the world, but that it has survived the changing world. It has its scars and strange looking unused
    appendages, but for it's intended purpose, it provided zero down time through the evolving years ( referring to porting time ). People that buy a
    new linux distribution could still use their old perl scripts as is. But additionally taking advantage of the newer features in the new release. Much
    like one can do with the x86 architecture.
    If we take a look at java for a moment, we'll see yet another example of the uglyness of evolution. Originally concieved of as a fresh new
    concept taking advantage of the state of the art in computer science ( If you'll forgive the proposition ) we're already in our 3'rd revision, which
    has made heavy use of the term deprecation. First we do it one way, then decide that there really is a better way of doing it. But now we've
    discovered a more elegant approach to event handling and change so we change things yet again. Each time, it was essential to maintain
    backward compatibility ( this is still a fledgling system, and supporters would not accept such unreliable lack of support with legacy applications
    as they might with the conversion from SunOS to Solaris, or mc6800 -> powerPC ). Java is in the same boat as perl and x86 in that as long as
    the language evolves, it will be plauged with legacy features. Thankfully I can think of little that is hurt by the existing evolutionary steps in Java,
    but it is still much younger than perl or x86. Give it a decade and we'll see how well it fairs against new and shining languages. And some will
    support Java even though it is considered archaic and too difficult to keep up with the new boys. Or stead-fast C coders will mock Java, saying
    C was the true language all along ( as some humorously still do about assembly today ).
    The key is really whether a life form ( or a technology ) has outlived it's usefullness. Java obviously hasn't. It's a good programming model (
    with far fewer points for error than C++, with what I'd call, similar support for the technology ). ( Notice I said model, since, obviously the
    execution time is subject to debate ). C is going to be around for as long as UNIX. Assembly as long as the discrete instruction model exists (
    I'm all for neural messaging systems personally. Interpret your code directly without compilation!! ;-) ). The x86 is still alive and kicking,
    simply because the technology is such that the underlying negative effects for a non-optimal instruction set are offset by pipelining and caching (
    as in the case of AMD's micro-op cache ). To boot, this performance increase in changing the ISA is miniscule compared to the inconvinience
    of developers supporting a new platform. The added cost of compatibility translation hardware is offset by the massive economies of scale. As
    far as I'm concerned, we were taught a long time ago to not program in assembly when you can program in C, ( and consequently, not program
    in C if you can use something more aptly suited to the task ). Thus the processor is a black box, and I could care less what instruction set it
    uses. Give me performance / cost ( and if I'm in a laptop, additionally devide that by power consuption ).
    So what of perl? Originally designed as a reporting language ( before the days of the Dynamic web ) it now finds itself primarily as the glue
    between c libraries. To my knowledge, perl was not designed as the creator or the repository of information, but for the "extraction", and
    "reporting" of that information. Thus the DBI hook to mysql and the CGI front end allows it to format the data found in so many of our web
    sites. But this specific functionality has been built anew by php. Doesn't the [cached] CGI method of c-like logic control structures seem
    outdated in the modern world of table generation and data reporting. There have been no new op codes in perl to conviniently generate an
    HTML table in perl ( though embPerl and the like do so nicely but at a much higher level ( and thus less efficiently ) ). Thus has perl been
    replaced by php or the like in the realm of simple DHTML DB reporting? And since HTML is a far more common report medium than
    vterminals, has the underlying theme of perl been superceeded? I'll leave this as an open item.
    Whatever perl's role in the web, it still has roles in System programming. I find perl much more powerful and pleasant to program in than sed,
    awk, or even bash. If you need to write a filter or data converter from one database to another, I doubt that you're going to use php, and possibly
    not even C ( unless you really don't know any others ). If you want to provide a summary of slack space used on your hard drive ( sorting by
    directories, then by files, etc ), I'd find a hard time doing this in any other language than perl. ( Not impossible mind you.. ) Also I find perl very
    useful as a configuration script or simple socket daemon. Additionally, I can take advantage of many libraries that have perl hooks into them.
    OpenGL, XML parsers, TK, QT, Gnome, OLE, NT registry, socketing, etc. I can take advantage of these without having to learn all the
    intracacies of each language. I can play with new technologies found on CPAN, and decide early on if they're worth persuiing. The late binding
    and non-strict type checking really aid in such a transparent interface.
    Peronsonally, I find these times exciting. Who will win out in the language wars? Of course there will be more than one winner, because there
    is more than one target audience. As each new computing need arises, existing languages will adapt, and new tailored languages will appear. It
    is this trade off that the devoloper has to make. Personally, I like the advantage of perl's wealth of c-library compatibility, so I write many
    things in perl ( and even write emulators of HTML templating, or even the FastCGI / java-serverlet model to suite my own needs, just so that I
    can make use of certain libraries that are not readily availble in php or Java ) It also means I can have a common library package for both
    configuration / database manipulation and CGI scripting.
    I like the open nature of perl ( hard to compile away into hidden libraries ), I like the "more than one way to do it" methodology. I like that I
    _can_ write strongly typed modules ( through perl 5.005's "my Foo $var = new Foo;" and the "-w" and "use strict" directives ), but can also
    write "perl -pe '$x++ if /^A/; END {print $x }' " and other such one line programs that I can test the concept of in less than 10 seconds.
    ( though the obove seems clearer with 'egrep "^A" | wc ' ). When solving such specific pre-defined dillemas, perl excels.
    I should hope that I have to say very little about the most important contribution of perl; it's regular expression library. Highly optimized C (
    depending on which version of perl you're using ), has managed to take an NFA construct and extend both it's efficiency and feature set. I have
    never seen such an extensive reg-ex package in all my years of programming. ( I would definitely be interested to learn of more powerful ones
    if any of you is able to provide me with such info ). php has seen fit to include perl reg-ex's, but I'm not sure how up to date, or how completely
    compatible it is. To be able to mathematically speak to your computer in such a way as to have it almost understand what you are thinking ( in
    terms of syntactic identification and manipulation ) never cieses to bring a smile to my face. Having the ability to intelligently merge a group of
    HTML files and into a single one with 3 lines of reg-ex code expresses such a mathematic bueaty I can not properly describe it. It isn't about
    doing it in fewer lines of code, it's about commanding power over symantics. Of course it seems cryptic to the uninitiated. So does calculus. Is
    that any excuse for shunning the language? Neuton invented Calculus because it was too tedius ( and in fact impossible ) to correctly describe
    bodies in motion without it. Yes I can write an optimized and easy to understand filter or parser in simplistic C constructs, but reg-ex allows you
    to attack the problem from a completely different and extensible approach. I've regularly written entire parsers in perl ( memory management
    alone eases the pain of writing a parser ) as a simple OO module that gets loaded into a larger program. Meta language is therefore much more
    obtainable in a smaller development group. Even today, perl's reg-ex is being extended with parenthesis matching, and the refinement of a
    procedural approach. So long as perl contains the most powerful and unmatched reg-ex library, I will not lose use for it. But meanwhile,
    nay-sayers will scoff at perl code littered with such "unreadible" expressions, happily ignorant of the calculus of the programming world.

    Lastly, on the topic of a first time language ( which seems closest to the original topic ). Perl is great in that it allows the most straightforward
    possible program. perl -e 'print "Hello World"'( as with BASIC ). You can even enter the debugger and type this in manually ( again, a la
    BASIC ). You can create an initialized variable the first time you use it.
    $x = 2 + 3; print $x;

    Essentially, I'm claiming that perl is every bit as good as BASIC as a first time language. Moreover, it's better than the old GWBasic, Apple
    Basic or TI Basic that I first learned on, in that we're not dealing with antiquted line numbers, or goto's. Intead we have very nice flow control
    structures ( last, next, redo ). Aside from that, you could completely take a BASIC lesson plan and "port" it over to perl, with the advantage that
    the student now contains some real world experience ( as opposed to BASIC ). I doubt system programming is a good second step. Perhaps
    CGI's, though you really do need to have _some_ programming experience before you're allowed to crash your school's local web server.

    Just for reference. I learned the

    Basic -> Pascal -> Scheme \
    C -> C++ -> System programming ( insert thousands of languages here including Java and Perl )

    I kind of like this approach, but am basically questioning if Perl could replace Basic as I've said above. Real work should _not_ be performed
    until a C like language is well understood. But there is no reason you couldn't return to perl at the system level.

    Well, this is long, and time is short, so I shall end you here.
    -Michael

    --
    -Michael
  72. Eerily reminiscent of VB by Anonymous Coward · · Score: 0


    IIRC, the deal for writing a "class" in VB involves naming the source file what you want the class to be called, and telling the IDE that it's a class now or something weird like that.


    to my untrained eye, it's somewhat akin to a C programer adding functions to their structs so they've got packaged functions but can still access the data members freely. Sure, you've got an object, but you're missing the point.

    Sounds like MFC. Ugh.


    :)

  73. Oops, I goofed by Anonymous Coward · · Score: 0


    The foo/bar/baz example had a point to it, which I implied by mentioning type safety, but never really addressed:

    You can declare a pointer (or a reference) to foo (the base class), and then that pointer can point (or the reference can refer) to an instance of any descendant of foo. And when you call a foo:: virtual function on that object, if it's been overridden in the subclass you'll get the subclass implementation. This is damned fantastic. If whatever Perl does isn't doing that, it's not OOP.


    1. Re:Oops, I goofed by kulturkritik · · Score: 1


      perl does that (I don't know how good the implementation is though).

      Anyway, what I was saying before is: a function is an abstraction. Implementations hiding behind interfaces as is the case with OO languages is another type of abstraction. The term "abstraction" is not something specific to perl, or OO languages, or computer science in general.

      An example:

      Interface Graphic
      {
      draw( ... );
      }

      Circle implements Graphic
      {
      draw( ... );
      }

      That's a Circle hiding behind a Graphic interface. What is actually happening (whether a circle or rectangle is being drawn) is irrelevant.

      In C (and every other languages w/functions), we can do this:

      count_active_users();

      We don't care how this is actually implemented, as long as it gets done and gives us an answer. That's another abstraction. It's irrelevant that it doesn't get called through a pointer. If you called it through a pointer, that would just be another layer of abstraction.

      Like you point out, implementing OO type abstractions (like implementation hiding behind interface) is a pain in the ass in C. Doesn't mean C doesn't have abstractions.

      offtopic:
      Even cooler (imo) than simply hiding an implementation behind a pointer (ie. having a virtual function table) and calling the right method based on the actual type hiding behind the pointer, is dispatching based on not only the type behind the pointer, but the types (*real* types) of all the arguments: multiple dispatch.

  74. None of that makes your programs OO by Anonymous Coward · · Score: 0


    Minimizing small blobs of global data, but instead putting things into record/struct/hash structures.

    It's not entirely clear what you mean here, but I get the impression that you're talking about structured programming, a much older paradigm.


    Bunching procedures together, whether or not the syntax allows it, to make it clear that they operate on a particular object.

    I'm sorry, but this makes no sense to me at all. Do you mean declaring them near each other in the source?


    Inheriting, whether through IS-A or HAS-A relationships.

    This is a start, except that "has-a" is when you add a member instead of inheriting.


    Making every procedure generic enough to be useful outside the original designed domain. This is what I mean by code re-use.

    That's what Weurth meant by "re-use" back in the 1960's when he was pushing structured programming. It's something you should really grasp before approaching OOP, however, so at least you're on the right track. Object-oriented reuse is a lot more powerful and interesting.


    Applying a reasonable amount of discipline regardless of what the language allows.

    That idea predates even the structured programming paradigm.


    That's what makes my programs Object Oriented.

    You seem to be saying that you pick words which appeal to you on the basis of their sound or something, and then you inent new definitions off the top of your head. That's very nice. I'm glad you have a hobby. As for me, I bathe and shave every morning and feed my cat -- and that's what makes my programs object-oriented!


    If I'm not being clear enough here, I'll try harder: From your post, it looks very much like you have no idea what OOP means or signifies. Learn a proper OOP language, write a lot of code in it, and get a solid grasp of what it's about. You will recognize that "solid grasp" because when it arrives, you will suddenly understand why these things you describe are irrelevant and/or old news. You are missing the point.

    Okay, okay, excellent! Excellent. Now it's time for you to get defensive and flame me, and claim that you do too know what OOP is. Right? Right. Well, tough shit. I really don't give a damn. It's your life. Do as you please with it.


    1. Re:None of that makes your programs OO by eric.t.f.bat · · Score: 1
      I'm probably not expressing myself clearly.

      As far as I can see, object oriented programming is basically common sense (ie what some people call "structured programming", as if there were any other sort) plus a bit of discipline (whether or not the language forces that discipline is largely irrelevant) plus rather too much mysticism and hype, which I ignore.

      Let's get buzzword compliant. OOP requires encapsulation, polymorphism and inheritance, right? I don't think I absolutely need the language to force me to use those methods. Encapsulation is struct + discipline. Polymorphism is basically a way of providing type-safety to all those old C-style hacks where you pass a pointer-to-godknows into a function and treat it however you like; if you're disciplined you don't need the language to help, tho gods help you if you mess it up. Inheritance can be simulated by "has-a" if "is-a" is not available. It's ugly but it works fine.

      My programs are OO because I'm immersed in the way of thinking that OO requires, not because I use an OO language. Most of the programmers I know who use C++ or Delphi don't write OO, because they do their damnedest to get around the discipline and just produce unstructured crap. This is easy to do in C++, which is really just a PDP-8 macro assembler anyway, and harder but not really hard to do in Delphi. Some of these guys could probably do it in Smalltalk tho -- they really have talent!

      As for me, I can write OO in just about any language except MS-DOS batch and Prolog, because that's how I program. Maybe I'm just a legend or something, I dunno.

      : Fruitbat :

      BTW, I'm not going to flame you simply cos you tend to get annoyed easily, but maybe you should take a rest and cut out the stimulants, cos you don't sound healthy at the moment.

      --
      I have discovered a truly remarkable .sig block which this margin is too small to conta
  75. Re:Object Oriented Perl by VirtualAdept · · Score: 1
    I agree with you that a lot of the OO built into perl is just layered on top of what was already there. I think, though, that it goes a little further than you imply. Perl, for instance, supports inheritance(the multiple model) fairly well. I tend to think of it as more analagous to C++.

    This said, there are a bunch of OO features that I wish perl would add when they reach 6(or earlier!). These are:
    1. Some sort of abstract/interface setup. I work at a web development firm, and have found on several projects it would have added a great deal to code re-use if I had been able to simply define a template and let people implement it.
    2. Data hiding. I really would like the ability to declare some of my object properties private and not have the programmer be able to access them.


    Its a wish list, anyways.
  76. Tips for perl as a first language... by perigeeV · · Score: 1
    Do:
    • Get more than one book. Buy/borrow about a half dozen. I've yet to find a combination of only one or two that was gentle enough to a newbie, yet still had comprehensive technical detail. In addition it is not uncommon for me to find five or more mistakes within the first three chapters. Nothing is worse than debugging when you're not yet confident in your own abilities, and it turns out to be an editing error in the book! I now cross reference everything I read.
    • Remember that these large volume texts are not actually going to teach how to program nearly as well as playing with code. Perl is one mother bear to learn(my opinion). It is a considerable maze, albeit an organized one. You don't learn a maze by reading a map. Start walking.
    • Find a LUG and pester the piss out of anyone claiming to have written a Perl script longer than 10 lines. After reading every iota of documentation first, of course. Bring them lots of beer. Maybe some sandwiches, too.
    • Learn shell, sed, awk, C, C++, Pascal, and Python first :)
    Don't
    • believe you will learn in "21 Days" or whatever Sam's Publishing would have you believe. Or maybe I'm just not that smart.
    • give up. It will hurt. You will be miserable. Life will have no meaning, and Wall is the anticrist. Until you get a slight mental tremor and all of the sudden you know what they all mean by scalar vs list context. Life regains meaning and maybe Wall isn't quite evil. The jury is still out on Christiansen, though :)
    --
    There's a spider on your shoulder.
  77. Hey Morons by pudge · · Score: 1

    Can't someone post a story about Perl and not have it devolve into a language war? Discuss the book and book review at hand, or shut up and go somewhere else.

  78. Re:Object Oriented Perl by andy@petdance.com · · Score: 1
    Using Perl's OO features, whether they're cheats or not, makes all the difference in the world when you're working on any sizable project.

    Damian Conway's Object Oriented Perl by Manning (the same publisher of the book whence springs this entire thread) is one of the best language-specific books I've ever read. The explanations are clear, the examples are meaningful, and it's funny as hell, to boot.

  79. Partial towards oreilly by befan · · Score: 1

    it is wrong (of the editors) to give link
    to oreilly and NOT link manning in the article
    (yeah yeah, its there somewhere, not in the
    first few lines which show up on the homepage).
    Infact, it is wierd that oreilly is linked
    at all, given that they neither publish the
    book nor own perl.

    syam

  80. about that CD... :-P by pedro · · Score: 1

    To give you an idea how open the perl world is, some joker posted the entire CD in tar.gz form (learning perl; camel book; cookbook, yada yada) to comp.lang.perl.misc a few weeks ago. 100 consecutive 64k posts. I HAD to download it 'cause I 'suck' my groups into INN. It WAS complete! The only folks who said a word about it, that I detected, were a couple of lurkers and those whining (justifiably) about bandwidth.
    Christiansen and Schwartz, whose work had just been offered up to the globe, and lurk and post to the group, never objected! (to my knowledge)
    Classy guys, those perloid fellas!

    --
    Brak: What's THAT?
    Thundercleese: A light switch.. of TOTAL DEVASTATION!
  81. Good Perl Book by Anonymous Coward · · Score: 0

    For those of you that learned it I was wondering what is a good Perl book to go out and buy to learn it, this one? or another?

  82. Programming has many levels - do you do assembly? by witty1 · · Score: 1

    Very few programmers do all levels of programming - there are much more effiecient ways to make some programs using assembly - and you use C (or C++). The important thing is the applicationg and when you are trying to integrate a web site with interactive content PERL is a VERY effective way. I am not trying to compete with you - go preach your I am better than you because crap to some other forum - obviously those people here are interested in using PERL to solver their problems and not interested in the mundane reasons of using C vs PERL. I could preach about PERL over JavaScript - but JS is by far the best way to do some things - go back to your cube and talk to your computer and create your objects.

  83. Re:Object Oriented Perl by Anonymous Coward · · Score: 0
    Yes, OO perl does really work. Plus it has a couple of nice features (or kludges, if you like), which I think this is the most beautiful example of:
    sub AUTOLOAD
    {
    my $self = shift;
    my $type = ref($self) or croak("$self is not an object\n");
    no strict qw(vars);
    my $name = $AUTOLOAD;
    use strict qw(vars);
    return if $name =~ /::DESTROY$/;
    $name =~ s/.*://;
    unless (exists $self->{_permitted}->{$name} )
    {
    croak("Can not access field '$name' in object of class $type");
    }
    if(@_)
    {
    return $self->{$name} = shift;
    }
    else
    {
    return $self->{$name};
    }
    }

    This code is ripped from somewhere (I can't remember where), and it takes care of about anything.

    • You can have "_private" and "public" variables, as long as you mention only the public ones in the "_permitted" hash
    • You do not have to create any accessor methods for your public variables if you do not want to, as the $object->fieldname( ); and $object->fieldname("foo"); -method calls are automagically handled.

    And yet another good reason to use OO perl: It is way easier to get your perl modules to work under Apache mod_perl if you always use the OO model.

    One last comment about "Some sort of abstract/interface setup."

    You can do something very similiar to that already. Have a look at the Tie::Hash -package. It defines all the methods needed for an implementation of a Tie::Hash object, but does not really implement them.

    I apologise for the lecturing. :-)
    btw, university of Helsinki (in Finland, yes) nowadays has a course on (OO) perl. Which is nice.

  84. Re:Object Oriented Perl by merlyn · · Score: 1

    Data hiding. I really would like the ability to declare some of my object properties private and not have the programmer be able to access them.


    Trivial. See Damian's excellent book.

    Most people don't do that, because as it turns out, unless the class is very well designed to begin with, anyone extending the class will need access to something that was left out. So most people follow the path of least resistance initially.

    But it is indeed possible and simple for me to hand back an opaque reference to you from my constructor that you cannot do anything with except hand back to me in a method call, and you can't even fake one up on your own -- I'll know.

  85. It's a shame... by Anonymous Coward · · Score: 0

    That your self-touted programming "skills" are not yet at the level where you can appreciate the beauty and elegance that is well-written perl code.

    One day, when you've grown and learned enough, perhaps you will. One can only hope. I do so hate to see young "programmers" stuck on a point in their personal growth curve.

  86. Smalltalk as first language by Stu+Charlton · · Score: 1

    Types are not everything. Some of the best OO programmers in existence first learned the concepts on Smalltalk, then later applied them to C++ and Java, adapting to the idosyncracies of a strongly-typed system.

    Perl is questionable as a first language because it is by its very nature a language that you can blow your leg off with - there is a lot of power, but knowing how to properly use that power is something a newbie won't grasp immediately.

    With Smalltalk, you get to learn the wonders of inheritance & polymorphism WITHOUT dealing with derived-types, casting, etc. You also get to learn the wonders of block-closures and the reasoning behind seperating interface from implementation. You also become (out of necessity) a _relentless_ unit tester, since you don't have compile time checking for semantic errors.

    So, some over-generalizations about "intermediate-level" programmers based on my experiences in the industry and in university:

    - Most programmers don't properly apply OO concepts in Perl, Java or C++.
    - Most programmers don't grasp the idiosyncracies each language brings to the OO programming model.
    - Most programmers don't test their stuff.
    - Most programmers don't seperate interface from implementation, nor do they see why they would want to.
    - Most programmers think cleverness is cooler than clean, readable, modular code.

    All of these can be attributed to LINEAGE of education. In C, it was tedious to test stuff, and you HAD to be clever to survive.

    So, I think Smalltalk would be a great first language. [s/Smalltalk/Python or Obj-C]

    --
    -Stu
  87. Smalltalk. by Stu+Charlton · · Score: 1

    See my post in the thread above.

    [Or Scheme / LISP, actually. All three languages are actually quite alike, with the edge in flexibility going to Lisp.]

    And to people who still think OO or LISP is retarded: get out of the dark ages please.

    --
    -Stu
  88. Boy, I'm easily baited today by GnrcMan · · Score: 1

    You talked about "strongly typed languages". Not language that are stronger typed than Perl. If you are referring to something different than I am,
    what do you mean by strongly typed languages then?


    The context of the discussion was Perl, I was referring to languages that are strongly typed relative to Perl. I thought I had clarified that in my first response to you. Sorry.
    What it comes down to is this: Do you agree that C and C++ are both more strongly typed than Perl? If so, there's nothing to argue about. If not, we differ on a fundamental point and there's no point in going any further.

    My second question was "What about arrays?" after your remark "don't get me started on Perl arrays". Your broad statement about your experienced
    lack of structure in Perl doesn't address arrays at all. Hence, it doesn't answer the question, it's just a flamebait.


    Your initial comment was:
    What about them? At least Perl has arrays, unlike popular languages like C, which just has monsters that try to look like arrays.

    I wasn't sure what that meant. An array is a list of values addressable by a subscript, ie foo[1]. I simply don't understand what you mean by "monsters that try to look like arrays". You seemed offended by my apparent dislike of Perl arrays, so I backed off and made a more broad statement which I felt explained my perceived problem with Perl, arrays included. I was trying to quickly and succinctly summarize my viewpoint. Let me try again:

    Arrays in Perl are used to hold data structures. While this makes things quick and easy, I don't think arrays have enough structure for a beginning programmer. While C structs allow you to defeat the structure, you at least have the option of defining a rigid structure and having the compiler enforce it.

    If there's any trolling going on, it's you doing it.

    Personally, I don't think statements of opinion with earnest attempts to explain the reasoning behind the opinion constitute trolls. I do perceive a statement like:

    At least Perl has arrays, unlike popular languages like C, which just has monsters that try to look like arrays.

    to be a troll.
    I don't see how my posts can be seen as trolls. They may be wrong (it wouldn't be the first time) but they don't have some key characteristics of flamebait:

    A. Make value judgements. I didn't say that Perl's lack of structure was bad. I simply stated that Perl lacks structure, which makes it unsuitable, in my opinion, for a learning language.

    B. Purposefully represent statements of opinion as fact. Again, I may be wrong, but that doesn't constitute flamebait.

    My initial response to you was hostile. Why? Because your initial post to me was hostile. Your initial comments to me gave me the impression that you think I'm wrong without explaining your position. Furthermore, their tone conveys arrogance and superiority ("I know something you don't"). If that is true, enlighten me. But don't turn open dialog into one sided interrogation. It's not very nice.

    --GnrcMan--

    1. Re:Boy, I'm easily baited today by Abigail-II · · Score: 2
      Do you agree that C and C++ are both more strongly typed than Perl?

      That depends on what your view is. If you mean that C and C++ have the types of variables more visible in program text than Perl, certainly. I disagree that they are strongly typed. Or whether C's typing mechanism is actually useful. Take for instance a look at this program:

      #include<stdio.h>
      #include<stdlib.h>

      intmain(void)
      {
      unsignedchar*c;
      floatf=10;

      for(c=(char*)&f;c<s izeof(float)+(char*)&f;c++){
      printf("%u",*c);
      }
      putchar('\n');

      return0;
      }

      Compiling that with gcc -Wall, you get:
      float.c: In function `main':
      float.c:9: warning: comparison of distinct pointer types lacks a cast

      A warning that shouldn't be there, and many type violations that don't get flagged at all.

      I wasn't sure what that meant. An array is a list of values addressable by a subscript, ie foo[1]. I simply don't understand what you mean by "monsters that try to look like arrays".

      In C, there is a strong relationship between pointers and arrays, strong enough that pointers and arrays should be discussed simultaneously. Any operation that can be achieved by array subscripting can also be done with pointers.
      Kernighan & Ritchie:
      The C Programming Language.
      Prentice Hall, 1988.
      C lacks useful operators on arrays. You can't add from arrays. You can't take pieces of it. Copying arrays is fun too. Look at the following program:

      #include<stdlib.h>
      #include<stdio.h>

      intmain(){
      int*a;
      int*b;

      a=(int*)malloc(sizeof(int));
      b=(int*)malloc(sizeof(int));
      a[0]=3;
      b=a;
      printf("%d\n",b[0]);
      a[0]=5;
      printf("%d\n",b[0]);

      exit(0);
      }

      When run, it will print
      3
      5

      This is of course because we copied pointers, not arrays. So, let's change the program slightly, to use arrays, not pointers.

      #include<stdlib.h>
      #include<stdio.h>

      intmain(){
      inta[1];
      intb[1];

      a[0]=3;
      b=a;
      printf("%d\n",b[0]);
      a[0]=5;
      printf("%d\n",b[0]);

      exit(0);
      }

      Fun. This won't even compile - due to a (to make the circle round) a typing error:
      try.c: In function `main':
      try.c:9: incompatible types in assignment

      So, that's what I mean with monsters. They call themselves arrays, but they really just pointers - and the language doesn't have anything to actual manipulate arrays - just pointers.

      Arrays in Perl are used to hold data structures.

      Rubbish. Arrays in Perl are used to hold data, just like in any other language. An array can be (an implementation of) a datastructure, or be part of a datastructure.

      I don't think arrays have enough structure for a beginning programmer. While C structs allow you to defeat the structure, you at least have the option of defining a rigid structure and having the compiler enforce it.

      Perl arrays certainly don't have less structure than C arrays or Python arrays. And just like in C or Python, or most other languages, Perl has more data structures than arrays. If you want structures, pseudo-hashes will approximate your needs. Compiler enforced checking, with the speed of arrays.

      Personally, I don't think statements of opinion with earnest attempts to explain the reasoning behind the opinion constitute trolls.

      "Don't get me started on Perl arrays" in a discussion about a beginners book of Perl doesn't contain any reasoning in my book. It was nothing more than a flamebait.

      My initial response to you was hostile. Why? Because your initial post to me was hostile.

      I think your first post was hostile.

      -- Abigail

  89. Browse Chapters On-Line by Anonymous Coward · · Score: 0

    You can browse parts of the book online at http://www.manning.com/Johnson/index.html

  90. Browse Chapters On-Line by Anonymous Coward · · Score: 0

    You can browse parts of the book online at http://www.manning.com/Johnson/index.html

  91. Cool by GnrcMan · · Score: 1

    Thank you. That's the sort of comment I enjoy responding to. If you want to continue this discussion, e-mail me. I'd be glad to discuss your points with you.

    Casey

    --GnrcMan--