Perl 5.6.1 Released, My Precioussss... 117
Pudge tells me
that perl 5.6.1 is released. Tell your boss you won't get any work done today, you have to, er, upgrade your personal knowledgebase of evolving regularly expressional technology. Then test every one of the bugfixes, like ""a\nxb\n" =~ /(?!\A)x/m". Pick your favorite new feature or bugfix from
the announcement
and tell us about it.
Re:What makes perl so popular? (Score:1)
Re:So What's so special about Perl (Score:1)
Start me Up (Score:3)
Re:Just a question (Score:2)
We have Stephen Cole Kleene [brighton.ac.uk] to thank for both recursion theory and regular expressions. According to a blurb in Friedl's Mastering Regular Expressions [oreilly.com] (pg. 60):
I'm still looking for reprints of Kleene's papers on regular expressions, but they seem to be hard to come by. Maybe I'm just looking in the wrong places.
Re:So What's so special about Perl (Score:3)
Everybody I know who tried Perl's regular expression engine never went back. The C RE engine (that the manpage from 1994 claims is alpha quality) just doesn't have the rich feature set that the perl RE engine has. Perl's RE engine is constantly stress tested and obscure bugs are fixed, I'd dare say it is more stable than the C RE engine as well.
Perl also has a very comprehensive (if a little incomprehensible) package repository called CPAN. If you are looking to do something that somebody might have done before, chances are they DID do it before, and released the sources for free to a nice searchable database.
All this is just the tip of the iceberg. You really have to learn Perl (there are some great books available) to form your own opinions on it.
Down that path lies madness. On the other hand, the road to hell is paved with melting snowballs.
CPAN.pm now wants to upgrade perl (Score:2)
Which to me seems a bit overzealous on the part of CPAN.pm. Some might even describe it as Microsoftian in its evil.
Is there any way to turn this "feature" of CPAN.pm off? Or am I stuck installing modules by hand until such time as I decide I want to upgrade to latest and greatest? (Not so bad for individual modules, but installing Bundles by hand is a royal PITA.)
--
Re:perl - what for? (Score:1)
The other reason is that Things can often be much simpler to do in Perl than in awk or sed. It all depends upon which modules you use.
-Dom
Braindead Perl (was:Re:Win32) (Score:3)
* It forks another process to work that could easily be done inside perl itself. This makes your perl script much faster.
* He used a string instead of a list in the system() call. This is a potential security risk and slows tbings down even more because the shell must be invoked instead of the program being executed directly by perl.
* He didn't use s2p(1) to create the perl script. Larry write it for a reason!
I saw a similiar piece of code where I work recently that spawned 3 separate copies of mkdir, separately. And Perl has a builtin mkdir() function. Needless to say, this error was corrected.
-Dom
Gormengast (Score:1)
Best fix? (Score:4)
Re:how do these people find bugs to fix? (Score:5)
Re:So What's so special about Perl (Score:2)
Mark me down as the exception.
I had a problem perl's RE stuff doesn't handle well. I had a fixed per program set of regular expressions (200+ of them, in priority order) and a lot of input strings that matched at least one of the regular expressions (on of the RE is .*, so there is always a match). I had to find the best match for each string, and the per string runtime had to be extremely low.
The only way perl does this is to read the input string (maybe) call study, and then run the REs one by one in priority order stopping when you get the match. In other words something similar to lex, but just a little too dynamic and otherwise different to use lex.
I wrote a big C++ program that made a NFA from all the regular expressions, transformed it to a annotated DFA, and then shoved strings through it. The cost to check a string was proportional to the string length, but (aside from cache effects) independent of the number and complexity of the regular expressions.
Once in a while even fine pre-built tools like Perl aren't good enough, and you have to hand craft one of your own.
That said, much of my regex work is in Perl or lex.
Re:So What's so special about Perl (Score:2)
You can get it from the author's web page [bell-labs.com]. The Markov chain one was written in C by him a very very long time ago as a prank new.news poster before the re-org (before ANSI C, or Perl existed). I do think this is an updated version though.
Well that's a fine benchmark, if that is really the kind of code you expect to write. The markov chain one at least does some I/O and uses real data structures. Neither are all that close to code I tend to write, but the markov one is quite a bit closer (I normally have data structures, and I/O for example).
Also note that this book was published in Feb 1999, so the book was prob. done six months before, with software possibly months older. The Java for the x86 may well have had Hot Spot stuff, but the Irix version may not have. Also as I recall I/O sucked big time for C++ (surprising to me, I expected it to win), and I/O for Java (also surprising, I didn't expect I/O to rock, but I expected it not to be so bad).
P.S. if you program go get the book. It really is good. It is one of the few that has a chapter on debugging (even if it is pretty elementary).
Re:So What's so special about Perl (Score:2)
In other words it used the library, and the library sucks? The C++ code uses the STL for all the heavy lifting. The Perl code does it in a straight forward manner. They all have the look of "get the job done" rather then "use a lot of tricks to make it as fast as can be". The C++ code doesn't pre-size it's vector (actually it has been a while, and I don't recall if it uses a vector).
That is pretty much a good aim for a book focused at non-experts. Or even busy experts :-)
Not surprising, compiler technology marches on. I expect the C++ I/O has improved a lot as well.
The question is what would they all do with a little expert tweaking? I remember thinking that C++ version would run faster just by changing the map's to hash_map's (assuming the implementation has them, most do).
I have no idea about the Perl version. Normally when I have to speed up Perl code I rewrite it in C++. I only have a vague idea about the Java since the only "fast" thing I wrote in it was a SSH client, and it beat out a few C (I assume) implementation on a Win95 machine, but blows dead goats on the BSD systems.
Re:Weak references (Score:2)
C provides free() for just that reason; In the event that a structure may have been allocated, you can always explicitly blast it when you are done.
That doesn't make C garbage collected does it? I mean is still cleans up auto variables by itself. Or C++ which cleans up dynamically allocated memory stored in autoptr variables.
Or do all three languages fall short? (admittedly Perl falls far less short)
No, garbage collection's sole reason for existence is to clean up for you. If it doesn't do that then it isn't garbage collection. Period. It might be useful, but it still falls short of being garbage collection.
Mark and sweep is expensive, but there has been twenty years of research in GC since mark-and-sweep was state of the art. Modern GCs can actually be cheeper then reference counts! Regrettably they tend to be a little erratic in when they fire. The real-time GC systems (there are some) are something I don't know a lot about, but I expect they are more expensive.
Re:Weak references (Score:3)
Doesn't Java count? It has at least 3 kinds of week references (at least as of Java2, maybe before). I think they differ both in how weak they are, and in how they react to destruction (at least one fires before the object is destroyed giving time to save to disk, or make a stronger reference; at least one fires after destruction). One or more of the weak ref types may prevent collection until the system is actually low on memory.
That is one way to fix circular references. Another way would be to have a better garbage collector which can collect up circular references (that is in fact the traditional difference between reference counting which fails on circular references, and garbage collection which works).
This isn't a slam on Perl, it is nice that it now has this feature. Ref counts also have nice features (they aren't faster then a good GC, but the find the garbage they do find at more reliable times so destructors can be relied on to go off at useful times -- there are some hybread systems that do both to get both advantages, like Lucent's Alef).
The more common use of weak references (in languages with proper GC systems) is to have a cache. The cached item stays in memory until a GC sweep takes it away, if it is needed after that it has to be recalculated or read from disk again or something.
Re:Just a question (Score:1)
As for why this particular type of grammar/language is called regular, I guess it's just because it has the strictest rules of the four.
--
Re:Weak references (Score:1)
Just because a language has some garbage collecting features doesn't mean you can live by poor coding standards (like not cleaning up after yourself). Besides, a full mark-and-sweep algorithm is quite an additional load on the processor. (one more reason why Java is slow.)
Re:What makes perl so popular? (Score:1)
The wheel is turning but the hamster is dead.
Re:TV Commercials (Score:1)
I think the record companies are having fun with their 100% legal rights in these cases. The more they do this, the more incentive bands will have to steer clear of the RIAA and folks.
The wheel is turning but the hamster is dead.
The existence of Perl 5.6.x confuses me... (Score:2)
This is not a troll. I really want to know if there's some reason why more people aren't using Perl 5.6.x?
--
Re:The existence of Perl 5.6.x confuses me... (Score:2)
--
Re:perl - what for? (Score:1)
Seriously, I use awk and sed in shell scripts, but they can be a pain for complex tasks. Also, Perl's RE set is much more robust than that of awk and sed. Learn perl -- then complain about it.
Re:What makes perl so popular? (Score:2)
Apart from that, the mindshare of perl is not insignificant. Chances are, someone's had the same problem you're trying to address so you might be able to find a ready-made solution already.
--
Re:Just a question (Score:2)
Re:Just a question (Score:2)
Re:as fun as a half-hour brace matching hunt (Score:1)
chop(@list) in list context returned the characters chopped in reverse order
The characters chopped in reverse order, not the list itself. People probably didn't notice this much because chop is maily used in scalar context, to see how many characters are chopped, which doesn't depend on the order of the returned list of chopped characters (choppees?).
Re:So What's so special about Perl (Score:1)
You might write a faster program in C.
You will program faster in Perl (or Python, or Rexx, or Ruby, etc..etc..etc...)
See this [ira.uka.de] for an interesting study.
RE Fixes... (Score:1)
Memory leak fixes are always nice, too...
Jethro
Re:Best fix? (Score:1)
tr/Delorean/Heart of Gold/g;
would work... sigh... 8^)
Jethro
Re:Best fix? (Score:1)
YSMV... (your semantics may vary) and horribly OT...
Jethro
Re:What makes perl so popular? (Score:1)
Ah, it doesn't matter anyway. Call it a troll, but M$ is just going to redefine fork the way they redefine all the rest of the "standards" they implement.
Perhaps you should RTFA.
Jethro
Re:What makes perl so popular? (Score:2)
It is not only extremely useful in a CGI aspect (though, arguably not as efficient as some "out of the box" -- i.e. modperl), but it is also very useful for many other things. I use it quite a bit as a cross-platform scripting language. It is nice to take things written on my BSD box, and run them on my desktop with ActiveState Perl.
There are modules for everything, from processing PDF to controlling your X10 stuff.
It doesn't get any better than that, IMHO...
So, when is M$ coming out with "fork" for Windows? 8^)
Jethro
Re:how do these people find bugs to fix? (Score:1)
A variable declared in the initialization section
of a for-loop has the scope of the whole function
in that case.
Re:The existence of Perl 5.6.x confuses me... (Score:1)
[localhost:~] tns% perl -v
This is perl, v5.6.0 built for darwin
Copyright 1987-2000, Larry Wall
...
Re:RE Fixes... (Score:1)
I like the sort fix, too. Bumped into that bug just last week...thought I'd blown a synapse.
Re:Just a question (Score:2)
To be clear, Perl's regular expressions are actually not regular at all, in the true mathematical sense of the word. Backtracking is one thing that immediately breaks the definition of the world regular. However, the term is catchy, and has since been (incorrectly) applied to any form of pattern matching.
For those interested, I suggest picking up a book on automata theory to learn more about all this, from a theoretical standpoint.
I have Introduction to the theory of Computation by Michael Sipser, ISBN 0-534-94728-X
as fun as a half-hour brace matching hunt (Score:1)
chop(@list) in list context returned the characters chopped in reverse order.
This has been reversed to be in the right order.
You just know this is one of those bugs that would've had people scratching their heads for hours trying to work out why their arrays were sudddenly in reverse order; trying to debug their code with copious foreach loops and print statements.
--
Re:What makes perl so popular? (Score:1)
LOL, I've got quite a few projects that use Perl to generate JavaScript to generate DHTML.
You can really tell that Perl was made to deal w/ text and data (hence the name: Practical Extraction and Reporting Language aka Pathologically Eclectic Rubbish Lister). It's one of the things that make the language so nice to work w/ in a web/database environment. This can have great benifits for reducing development time.
Another great strength of Perl is CPAN [cpan.org]. Perl has a great community behind it.
Above all, I just think Perl is a fun language. It's not full of rules and restrictions. It's very loose and tends to let you find out what the best way to do something is. It's not always the right tool for the right job but it fits nicely most of the time.
Re:What makes perl so popular? (Score:1)
Really? Hmm.. I work for a world wide Networking/Communications company with 160,000+ employees and we use Perl a lot.
We're not the only ones either:
You're right that they don't hinge all of their products on it but I don't think that's what Perl is meant for. It's all about the right tool for the right job.
Im only going to stick to the theoretical here but I have found some Perl code that simly defies common sense in production level and quality code. These little 5 lines of code that consist of the bulk of a COMPLEX order processing routine are just non sense to debug. That is like a hiehgt of mismanaged and ill-thought programming. Perl allows this so much easier than most languages. Say you can write bad code in any langauge and your right. Say you can right the most incomprehensible nonsense in Perl and your even more right!
I understand that Perl's flexibility allows for problems. With flexibility comes the need for responsibility and common sense. It's really not Perl's fault. I'd rather have that flexibility when I need it rather than have it stripped away. That's one of the main reasons I use Perl more than Java. Again, they both have their place when used responsibly (is this starting to sound like a beer commercial?
I think the programmer of the system enjoyed trying to make everything as complex as his twisted little mind could. Im not a slouch to programming really complex business systems that have insane requirements. But I just get so flustered when I inherit some project that has code that would win a Obfuscated Perl Contest
hands down. Its annoying and I spent a day trolling news lists and looking over my Camel book trying to figure out how in the hell some stuff works. Blah. behaviors change from version to version. No standards body controlling perl. (Not that the C/C++/Java people do much better..) and a ton of other factors just lead to this dislike for perl in a real business environment that has comple business needs. Perl for everything right, Not.. Everything has its place. The highend of business programming is not it for Perl.
I hate having to deal w/ code like that but I still think it's worth it to have such a wonderful language. It's a shame that most people let this kind of thing reflect directly on Perl instead of the programmer.
As far as changes go, that's just the way it goes. For a language to evolve, changes are inevitable. Java 1.1 and Java 1.2 illustrates this. I've been told about horror stories with C++ as well (I'm not proficient enough to tell you if that's true or not).
As I said before, I don't think the "highend of business" is where Perl belongs either. I think it fits nicely being the beautiful duct tape that it is.
Re:What makes perl so popular? (Score:1)
You know, I have a theory about why there is so much bad perl code out there. I believe it's usually a first language. Newcomers have no idea what it's like to manage someone else's code much less organize large projects. Until that can be experienced, there's no real incentive to keep the code clean.
The other half of it is just a bunch of twisted, sadistic wierdo's
Poetic feedback (Score:2)
@O'Reilly::Larry_Wall{Hacks};
Re:So What's so special about Perl (Score:2)
PentiumII400MHz ----- Lines of source code
C ----- 0.30sec --------------- 150
Java --- 9.2 ------------------ 105
C++ --- 1.5 ------------------- 70
Awk ---2.1 ------------------- 20
Perl --- 1.0 ------------------- 18
Now I don't know about you, but for the majority of my programs I'm happy with a 3x speed decrease to avoid the hassles of dealing with C (And I'm more than happy to have a 1/3 increase by avoiding C++!!!!!) I'm not willing to pay a 18x decrease.
Re:So What's so special about Perl (Score:2)
All of the programs could be optimized I'm sure, I know the Perl experts have offered suggestions on the Perl version. However, the test was comparing programs as written by people familiar with programming but not neccessarily experts the the language. It's not valid to compare expertly written programs, because most programmers aren't experts. Very few programs are optimized in real life, simply because there are always more important things which need doing.
Re:So What's so special about Perl (Score:2)
The advantage for both Perl and Java over C is that you can *write* code much faster in those langauges and still be sure that you don't have stray pointers and memory leaks, potential unchecked buffers etc. This means that you have more time to concentrate on writing good logic and using good algorithms, which in turn means that in the end, you end up with a much "better" application that works just as well. What you lost in speed of execution you gained in a nice architecture and with good algorithms.
Of course a really kick-ass C coder is just as productive in C, but those coders are extremely hard to find and very expensive. So in the real world with tight deadlines where computers are cheaper than coders, Java and Perl will give you a better run for your money that C will.
That's not to say that C and C++ doesn't have it's places - it does. I wouldn't code a game in Perl, for example, nor would I code an operating system in Java. But I would also never code an e-commerce site in C (actually I have, but that was in 1996
BTW.. Perl's real strength from a purely language point of view is probably it's close relation to regular expressions, which makes string handling very easy to do and extremely hard to read for other coders who are reading your code. You can do more in one line of Perl (string handling) than you can with 1000 lines of C code in many cases.
Re:So What's so special about Perl (Score:2)
For non-graphical applications, Java tends to be quite close to C++ in speed. I'm talking about stuff like math and those kinds of things. They are JITted to almost the exact same code that a C++ app would have been compiled to in the first place. I also have a hard time understanding how Perl would be faster than C++ and AWK almost as fast as C++. There must be something seriously screwy in some of those implementations.
I'm sure there are plenty of benchmarks to show very different results. For example, many CGI benchmarks show Perl and Java to be very similar in speed and only slightly slower than C based CGI programs. Go figure..
About not being able to pay a 18x decrease.. Well.. If your response time on the web server is 0.1 seconds, does it matter if it's 18 times slower than the optimal? Especially, if the code is now much easier to maintain and extend.. As long as the application is fast enough, it doesn't matter IMHO.
Re:So What's so special about Perl (Score:2)
So.. I decided to write my own little - very simple - test just to get a ball park feel of language speeds. A small app that has two nested loops and calls a method, passing two integers as parameters and returning an integer as the result. I wrote a C, a Perl and Java version and compiled and ran these. My machine is an Athlon 500 with 128 megs of ram running a Microsoft OS. The Perl in use is ActiveState's 5.005_003, the Java VM is JDK 1.3.0_01-beta and I compiled the C app with both gcc and Visual C++ (no difference in speed for those). The result is that the Java app is fastest with a run time of 3 seconds and that includes loading java.exe, granted it's only a marginal overhead. The C comes at a very close 2nd with 4 seconds. The Perl version was so slow that I had to decrease it's iterations to 100 times less than those of the C and Java version. Then it took 7 seconds. I guess it would have taken 700 seconds otherwise but I couldn't wait that long.
Now I know this proves very little. For example, that Java is faster than C probably only shows that the HotSpot could optimize the code VERY well as it ran and thus be faster. I know that a normal Java app wouldn't do this well compared to C.. But in this simple case, it did BETTER. Perl.. well.. the app ran so slowly that I decided to INLINE the method call.. Get rid of it and just say $x = $i * $j; instead. It STILL takes 300 seconds - 100 times slower than the Java version.
The *ONLY* thing this proves is that benchmarks can be tilted in any direction you want. Unfortunately I can't post the sourcecode because it triggers the "junk" filter. I can email them to whoever wants them tho.. There's nothing special in them anyway and anyone could do the same test to see themselves quite quickly.
Re:So What's so special about Perl (Score:2)
Re::) You mean the DeCSS engine? (Score:2)
Some people really should use a real OS (Score:1)
Yeah that's a troll :-)
% perl -vThis is perl, v5.6.0 built for i386-openbsd (with 2 registered patches, see perl -V for more detail)
Copyright 1987-2000, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/ [perl.com], the Perl Home Page.
% uname -sr
OpenBSD 2.8
Patch is broken (Score:1)
- german
All tests successful! (Score:1)
Now
All tests successful.
u=0.68 s=0.3 cu=46.56 cs=8.14 scripts=255 tests=13098
Great work!
- german
Re:Win32 (Score:1)
$_ =~ s/foo/bar/;
And not closed/opened/closed/opened file handles and lots of other pointless stuff.
Win32 (Score:2)
Xix.
P.S. Line from fave braindead contracted Perl program I have seen this year:
system("sed -f $sedfile < $infile > $outfile");
Re:Just a question (Score:1)
-_Quinn
Re:The existence of Perl 5.6.x confuses me... (Score:2)
Actually I believe perl 5.6 was in the Darwin distribution a few weeks after it was released.
Re:What makes perl so popular? (Score:2)
Well, as you can already see from some of the threads, some people don't like Perl at all. It's just a matter of time until a major Perl vs. Python flamewar breaks out.
I think that inclination toward Perl has a lot to do with your background. As much as I like it, I have to admit that a lot of the syntax that so many people complain about can seem a bit quirky -- all of that punctuation and funny variable names, and all kinds of idiomatic idiosyncrasies.
But what many Perl-bashers don't realize is that almost none of this was invented the first time in Perl: Most elements of Perl syntax have a precedent in languages and tools that are common and familiar if you happen to use and adminster Unix every day. Shell script languages, sed, awk, grep and many other regular expression tools, and C -- all of these have idioms that you find again in Perl.
So if you live Unix every day, and these idioms all come naturally to you, then Perl doesn't seem that unnatural at all. This is the way I feel about Perl -- it is very grokkable, its syntax flows out smoothly, it just seems to feel like the right way to express these things.
But then there are the people who just can't a feel for Perl at all. In many cases, I've found that these people aren't as familiar with the standard Unix tools either, so the idioms of Perl that seem so ordinary to me are entirely alien to them.
Incidentally, I am very amused by the posts in this thread that complain about regular expression syntax, as if they are pointing out a weakness of Perl. Regular expressions are a mathematical concept and powerful computer science tool that have been known about for decades. And as hard as the syntax may be to learn, Perl follows tried and true idioms that have proven their worth in numerous tools and programming languages: the various greps, awk, Tcl, emacs, the C regex libraries and the POSIX standards. These all certainly have their differences, but they converge on a syntax for regular expressions that is very nearly a standard; and Perl has the most sophisticated version of them all. Maybe, just maybe, this common syntax is not so obtuse after all; maybe, just maybe, it's the most efficient and compelling way to express that is intrinsically quite powerful and complex.
Re:sleep (Score:2)
What an incredibly ignorant statement.
Perl 5.6.1 on Windows platforms is currently in beta and should be available soon from ActiveState [activestate.com].
In the future, you should only comment on subjects you are actively educated in.
Re:Just a question (Score:2)
I think this is the single biggest misunderstanding of Perl.. People call perl line-noise because of all the shift-numbers scattered throughout.
The fact of the matter is that the regular expression package is a very standard mechanism of pattern matching (though there are slight syntactic deviations from one implimentation to another). If you don't understand the importance or power, then you've obviously never taken a compilers course, and have little room to critique a language. Additionally, sed, awk, and even C or Java _do_ have regular expression packages. If Perl expressions are incomprehensible, then you're no better off there (with possibly the added benifit of seeing a class name that denotes what's going on).
The fact of the matter is that the traditional C / Java style string searches DO exist in perl. You have printf with %s includes, you have "index", "rindex", etc. But they suck for complex operation (in both performance and readibility).. Once you actually spend the time to learn expression matching it becomes a powerful tool and actually makes it easier to read complex parsing code. (just think of how difficult UNIX
As for the other 'confusing notations', such as $hash_ref_name->{field_name}[ $index ]. This was a necessary evil to maintain 'string interpolibility'. Meaning, we aren't restricted to 'res = sprintf( "value = %s, %i\n", name, age)'. We can now just say $res = "value = $name, $age". Again, once you learn the rule-set, it makes string-based operations significantly easier.
The problem is that it's now being used for things other than text, so these get in the way.
In fact, Perl has one of the easiest to read variaents of the regular-expression language, since it allows liberal use of white-space and comments. If someone throws together a 5 line regular expression, then it's no better than a c coder that put everything on the same line with little or no white-space. It's just a matter of programing style (which admitadly most perl coders lack).
The addage, "best tool for the job" applies.. If you're doing text manipulation (which often includes web page generation), then Perl is indispensible. If all you're doing is back-end database manipulation, maybe Python, VB or Java is better suited. I wouldn't advocate Bash programming because the same arguments that apply to Perl are doubly so in many other shell languages.
Lastly, as to the stability of perl. As long as you don't resort to volitle C code or "experimental features" of the reg-ex's, then you're pretty stable (aside from memory leaks). I've rarely ever had perl core without one of these two factors. Yes there are well documented ways that you can abuse regular expressions (the 50 million year search time due to exponential back-tracking, for example), but that's part of learning the language.
-Michael
Re:how do these people find bugs to fix? (Score:1)
IIRC g++ (the gnu c++ compiler) does something similar when the Wshadow switch is enabled.
--
Re:What makes perl so popular? (Score:2)
C jokes are about pointers to structures of arrays of arrays of pointers to structures.
Perl jokes are, as we just saw, /(?!\A)x/m
"a\nxb\n" =~
The regexps are much more useful in day-to-day life.
Re:how do these people find bugs to fix? (Score:1)
Re:What makes perl so popular? (Score:1)
Oh, and you can use Perl for ASP, just go to http://www.activestate.com [activestate.com]
Re:CPAN.pm now wants to upgrade perl (Score:1)
What you really want is http://www.cpan.org/modules/by-module/Net/libnet-1 .0703.tar.gz [cpan.org].
-Gerard
http://www.lanois.com/perl/ [lanois.com]
Re:What makes perl so popular? (Score:1)
Really great for slicing and dicing those text strings. Just about any pattern I can imagine can be parsed. Probably more then I imagine, 'cause I've only learned about 50% of the regular expression syntax.
I'd never seen associative arrays (hashes) until Perl, but they're great, they make it so much easier to organize information. I believe LW himself said something like "if you're not using associative arrays in your Perl script you're probably doing something wrong." I really didn't grok the significance of hash tables (the underlying mechanism) until I encountered AAs in Perl. Now I love hash tables.
which includes the fact that its interpreted (no compilation), easy conversion between types (or maybe its really no types), anonymous variables (or whatever you call those $_ things, they're really convenient once you get used to them), almost all the neat little system functions C, and a flexible/redundant syntax (but with the potential for greater obfuscation) which makes perl more like a human language then a computer language, but not everyone will think that last item is a good thing.
Re:CPAN.pm now wants to upgrade perl (Score:1)
Re:Best fix? (Score:1)
Better yet! We can now implement RFC2795 [isi.edu] (the Infinite Monkey Protocol Suite) in Perl! Who wants to start a page on sourceforge? :)
Shayne
:) You mean the DeCSS engine? (Score:1)
A couple months ago, I would just have said "hmph, he's bluffing!"
After DeCSS, I realize that if 7 obscure lines of code can stand for all the random looking strings and C++ string handling routines, then Perl is the way to go for text[/signal?] processing.
I wonder if learning Perl could help my language theory professor to implement a revolutionary Natural Language Processing compiler in her lifetime.
Re:Just a question (Score:2)
In conformity with a fixed procedure, principle, or discipline.
Regular expressions provide an regular or ordered way to specify patterns.
Re:Best fix? (Score:1)
tr/Delorean/Heart of Gold/g;
would work... sigh... 8^)
I think you mean
s/Delorean/Heart of Gold/g;
The tr/// operator is translation, and s/// is substitution.
--
Re:Just a question (Score:1)
Re:VC++ for loop scope (Score:1)
Re:Weak references (Score:2)
Finalization in Java involves calling a destructor function from the garbage collector. This is ugly, because you have no idea when it will be called. It might be called from an unexpected thread, or when resource locks are set that the destructor needs. So Java finalizers have to be very carefully written, and can be a source of wierd, hard to reproduce bugs.
Perl destructors ("DESTROY") are called when the reference count goes to 0. This occurs at a time defined by the source code that owns the object, not some random time determined by garbage collection. So the uglier issues of asynchronous finalization are avoided. Reference counts are clean conceptually; the remaining problems are overhead and memory leaks.
Reference counts create a leak problem for circular reference structures. Weak pointers offer a mechanism for solving that problem. It's not airtight; you can still write programs that leak memory. But weak pointers help. Basically, anything that's a "backlink" probably should be a weak pointer.
One of my back-burner projects is a paper called "Pointer Patterns". It's on how to use strong and weak references in a way that eliminates the possibility of both memory leaks and dangling pointers. Basically, you have to be clear on which references "own" stuff and which don't. I was writing about C++, but something on Perl may be in order.
(I've been writing a proposal for "Strict C++", a set of restrictions that eliminate the possibility of buffer overflows and dangling pointers without too much run-time overhead. Basically, you have to use the STL, and you have to use some things like auto_ptr to allocate anything. "new" and "delete" are not used. Some additional compile-time checks are made. Iterators are allowed, and checked. Most of the checking can be optimized out without loss of safety. C arrays and arithmetic on raw pointers are not allowed, but you can get the same effect with checkable iterators. The overall effect is the safety of Perl or Java without the overhead. But that's another topic.)
Weak references (Score:3)
A structure with backlinks, such as a tree in which each node has a back pointer to its parent, is a great use for weak links. If you do that in Perl now, you can get a memory leak, because it looks like a circular reference and the reference counts won't go to 0. If the backlinks are weak links, the tree will be deleted when all external references to it go away.
The Perl implementation of weak links turns weak links to an object into "undef" when all the regular (strong) links go away. It's not clear if this can result in an object being deleted while in use. When you dereference a weak link, does that bump the reference count? Unclear. Details like this really matter in threaded programs, where one thread might drop an object in use by another thread. The Perl documentation is hazy on this.
I'd like to use it, but my Perl code has to run on servers that don't run the latest Perl. It's going to be useful in future, once newer Perl implementations are widely deployed. Once it's standard, widely used tree structures like HTML::Element should use it.
Re:What makes perl so popular? (Score:1)
Okay we can go into the theres 9,000,000 ways to do it argument here if you want but I dont see large corporations hinging their products on Perl. In Java, or C++ there is OWTDI not TIMTOWTDI
When you talka bout structured programming environments it simplifies the process of having a coding standard and everything if you dont have to nail down all of the frivilous details of a language.
Its just silly when you have to become granular about rather basic programming constructs and how to use them (IMO).
Im only going to stick to the theoretical here but I have found some Perl code that simly defies common sense in production level and quality code. These little 5 lines of code that consist of the bulk of a COMPLEX order processing routine are just non sense to debug. That is like a hiehgt of mismanaged and ill-thought programming. Perl allows this so much easier than most languages. Say you can write bad code in any langauge and your right. Say you can right the most incomprehensible nonsense in Perl and your even more right!
I think the programmer of the system enjoyed trying to make everything as complex as his twisted little mind could. Im not a slouch to programming really complex business systems that have insane requirements. But I just get so flustered when I inherit some project that has code that would win a Obfuscated Perl Contest hands down. Its annoying and I spent a day trolling news lists and looking over my Camel book trying to figure out how in the hell some stuff works. Blah. behaviors change from version to version. No standards body controlling perl. (Not that the C/C++/Java people do much better..) and a ton of other factors just lead to this dislike for perl in a real business environment that has comple business needs. Perl for everything right, Not.. Everything has its place. The highend of business programming is not it for Perl.
okay I feel much better now..
Jeremy
Re:What makes perl so popular? (Score:1)
I cant help it now I have this illogical aversion to perl.
But im not really against it honestly, Like I said its just a matter or procedure and a little common sense and consistency and any project can use it.
I really dont let it reflect on perl because I understand that it is a function of a programmers skill how elegant and clearly understood the code is (even using neat tricks you prolly wont see in other languages ive seen clearly nice and easy to read Perl)
I guess those late nights several weeks in a row brainwashed me.
I also like being able to run it on any platform (heh I almost think Perl is more cross platform than Java
Anyways, I was just ranting and being a lil non-sensible. I really dont hate Perl or go out of my way to see it come to an early doom
Jeremy
Re:What makes perl so popular? (Score:3)
Given that all of those are available to ASP use whichever you like to your hearts content.
The most common language is VBScript in ASP. However I have seen them all used to varying degrees of coherency and success. (The perl parts being the least coherent and most painful to fix... odd) Anyways apples and oranges. Cant compare ASP to Perl. Try comparing VBScript to Perl. Then we can get a good discussion about two languages going.
Jeremy
Re:Just a question (Score:2)
S --> a
or
S --> aA
or
S --> lambda
Where S and A are any non-terminals, and 'a' is a terminal. Lambda represents the null string.
Example:
S --> aaA
A --> bA | b
regex = aabb*
I hope this helps. To gain further insight, do a net-search on "DFA".
NAS
Re:Just a question (Score:2)
Re:Sorry, Jamie... (Score:1)
Not posting anonymously because I'm standing behind what I'm saying. Please take that into account, moderators, if you consider this post.
Thank you.
--
Re:Just a question (Score:1)
Re:Just a question (Score:2)
Re:Just a question (Score:2)
Just a question (Score:3)
Re:VC++ for loop scope (Score:1)
Care about freedom?
Re:So What's so special about Perl (Score:1)
At first though I was a little bit intimidated by Perl, having heard that it was ugly and hard to understand.
It reveals that it isn't, and for a very good book on beginning with Perl one should definetly think about "Learning Perl" from Randall Shwartz.
Very narrative structure, interesting read. That book changed my life ;-)
It may not go in all the little details, but for me it was enough to get me started and start doing nifty things right away.
Re:Best fix? (Score:1)
Re:how do these people find bugs to fix? (Score:1)
And this... (Score:3)
--
Scott Robert Ladd
Master of Complexity
Destroyer of Order and Chaos
how do these people find bugs to fix? (Score:5)
"Say, Cletus, ah jist noticed that "a\nxb\n" =~
then again, i suppose it's about as easy as finding all the little discrepancies between Microsoft's idea of C++ and the ANSI standard -- a famous example is Microsoft's interpretation of the scope of variables declared inside the conditional section of a for loop. with "for(int i..." in standard C++, i's scope is for the duration of the loop. in MSVC, you've just declared a new variable, so putting two for loops in a row with the same variable initialization will cause compiler errors which you *shouldn't be seeing*.
--nick
Just an answer (Score:2)
"Regular" - formed, built, arranged, or ordered according to some established rule, law, principle, or type.
"Expression" - a mathematical or logical symbol or a meaningful combination of symbols.
Put them together, and it's fairly straight-forward terminology that comes from computer science.
(I remember first studying them, outside of Perl, in my Discrete Structures CS class.)
My Favorite Bugfix (Score:2)
In other words, ALL YOUR BASE.PM BELONGED TO ISA().
But it's fixed now.
This is obviously a troll. (Score:2)
Re:Weak references (Score:2)
Python 2.1, currently in beta, has them too. See the development docs [sourceforge.net].
What makes perl so popular? (Score:2)
Re:Just a question (Score:2)
And a regular language is the collection of strings that can be generated by a finite state automaton.
i think... somebody will correct me if I'm wrong.
Re:Just a question (Score:2)
Re:VC++ for loop scope (Score:2)
There are much more interesting errors in MSVC. Incorrect scoping of namespaces with a using declaration, incorrect template instantiation, and lack of support for template friends are just a few.
Hang out on the comp.lang.* newsgroups for a few days and I'm sure you'll come accross plenty of implementation bugs. It's true in comp.lang.c++, at least.
Just wondered (Score:4)
--------------------------------
Re:What makes perl so popular? (Score:2)
Programming perl has a joke or two on every page making it seem like fun to learn that crazy language.
Not to mention the sense of power you feel when you type some code that is incoherent gibberish to 99.99% of the world but is actually a usefull perl program.
-----------------------------
kaaaameeeeeeehaaaaaameeeeeha!
-----------------------------