Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cornell!uw-beaver!fluke!inc From: inc@tc.fluke.COM (Gary Benson) Newsgroups: comp.lang.perl Subject: Re: "MOST COMMON NOVICE BUG" contest Message-ID: <1990Mar16.010322.18464@tc.fluke.COM> Date: 16 Mar 90 01:03:22 GMT References: <15230@bfmny0.UU.NET> <15232@bfmny0.UU.NET> <1118@etnibsd.UUCP> Organization: John Fluke Mfg. Co., Inc., Everett, WA Lines: 71 In article <1118@etnibsd.UUCP> vsh@etnibsd.UUCP (Steve Harris) writes: # So, what are the "TEN MOST COMMON NOVICE BUGS" in perl? I nominate: # # Placing a comma after a filehandle in a print statement. # # Anybody care to add more? Novices, SPEAK UP!! # Experts, try to remember when you weren't! # # print STDOUT "Just another Perl novice\n"; # -- # Steve Harris - Eaton Corp. - Beverly, MA - uunet!etnibsd!vsh Having just finished my first 500 lines of perl script qualifies me as a novice, I'd say. I'm not sure what a novice bug is, but the two things I do wrong most frequently are: 1. Leaving off ; at the end of a statement; This is usually the first thing I look for on the line just before the one perl reports is responsible for stopping compilation. 2. Losing track of my pairs of { } This is always reported as an EOF problem, so I know right away what I did wrong. I used to always look at the bottom of the file (or the line reported), but now I know to look in the last place I was working. I was the person who posted a list of novice questions a month or so ago, and I have come up with a few "journeyman novice" questions: 1. It seems that perl scripts are compiled just prior to execution. Would there be any benefit to a perl compiler that, like C, would JUST do the compilation and create a file (a.out might be a cool name or maybe p.out). This way, I could store the executable somewhere and not have to recompile each and every time. Why is perl NOT like that right now? I realize that compilation doesn't take long for my little 100-liners, but for a SUPER MACHO HACKER program, it might be significant... 2. I am studying C right now, too, and have just learned about multi-dimensional arrays. Are these possible in perl? Do you set them up similarly to the way C does it? If they are possible, does anyone have a (well-commented) example showing how to set up and access, e.g., a 3-D array? If they are not possible, why not? Is similar functionality provided some other way? I think they'd be really useful, espcially in database applications. 3. I have not been able to sort the output of a perl script yet. I always have the script just create a "raw" file, then go out to unix to do the sort. Can someone show me the best way to do those kinds of things inside perl? What other unix-y things are easier, faster, prettier, handier, or more elegant done inside the script than outside? Thanks to all for this wonderful newsgroup - I am saving upwards of 10 postings a day. Now I've got to write a perl script to extract the lines of perl! Before I subscribed to this, I sent email to Larry asking for help. Wow. His auto-mail-answerer informed me he's booked till the turn of the century, so I am especially grateful that he is active in this group. open (WOW, "# wowmon$$"); print WOW "Hack another just perl"; -- Gary Benson -=[ S M I L E R ]=- -_-_-_-inc@fluke.tc.com_-_-_-_-_-_-_-_-_- There are very few personal problems which cannot be solved by a suitable application of high explosives. -Anonymous