in reply to Beautiful Perl

I'm trying to determine if by "beauty" you mean "idiomatic". That's what I think you mean, because you mention Perl's syntactic flexability.

While others might find it ugly, I think code like

select((select(FH), $|=1)[0]);
is beautiful. It is a great example of lists, list slices, and using return values meaningfully.

I think we should try to find Perl's equivalent of the Euler equation for mathematics. For those of you not familiar with it, it shows the relationship of five "basic" elements of mathematics: e (the natural logarithm), i (the square root of -1), pi (the ratio of a circle's circumference to its diameter), 1, and 0. The equation is e(i * pi) + 1 = 0. Does Perl have something like this? Something that shows a relationship between some of the building blocks of the language?

_____________________________________________________
Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^2: Beautiful Perl
by BUU (Prior) on Mar 26, 2005 at 21:54 UTC
    If you were going for "relationship between some of the building blocks of the language", I'd have to advocate:

     open my $file, "name" or die "Error";

    While in no way profound, difficult or complex, I feel that it beautifuly demonstrates just what we like about perl. Or maybe not =].
Re^2: Beautiful Perl
by djantzen (Priest) on Mar 27, 2005 at 00:19 UTC

    That's an interesting question, but first, what are the basic elements of Perl? The functions? The datatypes? The contexts? Control structures? If so, that's a tremendous amount of variability that could give rise to any number of "Euler equations".

    It seems unlikely to me that you could come up with a single comprehensive expression of the internal cohesiveness of a programming language. I think you'd either have to reduce it's components to more basic notions (for example, thinking of Perl's datastructures as variations of the list datatype), or generate some higher level principles using Perl. Notice that the elements of math that Euler was relating were precisely defined ideas expressed within the language of mathematics, not the language of mathematics itself, if that makes any sense.


    "The dead do not recognize context" -- Kai, Lexx
      I agree with your final statement there. The prospect of coming up with such a singular Perl statement is certainly a confusing and subjective one, but it would be interesting to see people produce comprehensive code and explain its beauty and significance.

      I think Perl's regex ease-of-use allows for its abuse, and in turn, some truly powerful and awesome and beautiful code, such as Abigail's prime number regex.

      _____________________________________________________
      Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
      How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart