Live data from Hacker News

Perl is 26 Today

modernperlbooks.com

161–170 of 194 posts

Re: Perl is 26 Today

#161

Earlier quoted context omitted.

I first looked at perl last week and also shared your sentiment. At first when I saw perl I was aghast. The "ugly" $%@ syntax seemed pointless and unreadable. Then I decided to take a look at a non-beginner book, Intermediate Perl http://it-ebooks.info/book/879/ . I was surprised and excited 50 pages in because I realized that Perl had a wealth of tricks , and that that "ugly" $%@ syntax actually had some cool reperc…

Unfortunately -- and this is one of the many "banana peels" in Perl 5 -- even a simple statement like print x if x > 5 is problematic in p5 for a whole bunch of reasons: (1) At a bare minimum, what you really need to say is: print "$x\n" if $x > 5; That extra "\n" is a definite turn-off to a lot of people when the get their very first look at Perl. Really, the default these days should be more "say"-like. Of course,…

This is because it is by no means obvious as to which of the more "active" parts of the original expression

Isn't it? If someone told you, really you to do just that, would you actually have a problem carrying out that command given a way to print something, a container, and a value to check against the container contents?

Also, here's me preference:

  say $x if $x and $x > 5;
Need to catch zero?

  say $x if defined $x and $x == 0;

Re: Perl is 26 Today

#162

Earlier quoted context omitted.

The world has moved on, we've got more sane abstractions. PSGI[1][2] (modeled after WSGI) is basically CGI re-imagined and done better. 1: http://www.modernperlbooks.com/mt/2011/03/why-psgiplack-matt... 2: http://search.cpan.org/~miyagawa/PSGI-1.102/PSGI.pod D'oh! Now I see below that your duplicate of this question got the love it deserved already...

thanks for the links. A question: How long before testing ends? 2014 or 2015?

Huh? I either don't understand your question, or whatever you are implying has gone right over my head.

Re: Perl is 26 Today

#163

Earlier quoted context omitted.

Unfortunately -- and this is one of the many "banana peels" in Perl 5 -- even a simple statement like print x if x > 5 is problematic in p5 for a whole bunch of reasons: (1) At a bare minimum, what you really need to say is: print "$x\n" if $x > 5; That extra "\n" is a definite turn-off to a lot of people when the get their very first look at Perl. Really, the default these days should be more "say"-like. Of course,…

This is because it is by no means obvious as to which of the more "active" parts of the original expression Isn't it? If someone told you, really you to do just that, would you actually have a problem carrying out that command given a way to print something, a container, and a value to check against the container contents? Also, here's me preference: say $x if $x and $x > 5; Need to catch zero? say $x if defined $x a…

Personally i find all of these forms weird. In a one-liner you wouldn't care, and in a full program the inputs would be validated earlier and separately with useful error messages.

Re: Perl is 26 Today

#164

Earlier quoted context omitted.

This is because it is by no means obvious as to which of the more "active" parts of the original expression Isn't it? If someone told you, really you to do just that, would you actually have a problem carrying out that command given a way to print something, a container, and a value to check against the container contents? Also, here's me preference: say $x if $x and $x > 5; Need to catch zero? say $x if defined $x a…

Personally i find all of these forms weird. In a one-liner you wouldn't care, and in a full program the inputs would be validated earlier and separately with useful error messages.

Here's my use case for most post conditionals:

  for my $item ( @items ) {
    # Weed out the things we don't want to process
    next unless $item;
    next unless $item->{foo} {bar} {baz} =~ /quux/i;
    
    # Yep, these are good for processing
    $item->{othername} //= "$item->{foo} - $item->{baz}";
    process( $item );
  }
Could that be done using maps and greps, and even be faster? Sure. Would it be harder to reason about and add documentation to? Probably.

Additionally, I use them for parameter verification in subs:

  sub foo {
    my ($cowbell,%attrs) = @_;
    die "Needs moar cowbell!" unless $cowbell;
    die "Invalid color!" unless $attrs{color}//'' =~ /\A(bronze|silver)\Z/i;

    # blah
  }
P.S. That's not to say I don't love a good map and grep combo, I do. After a certain point of craziness I convert to a loop and document a bit. I tried to add enough items to the loop that it would be a cumbersome map and grep.

Re: Perl is 26 Today

#165

Earlier quoted context omitted.

I would say "pretty fantastic" is an understatement...CPAN is the gold standard of library support

Maybe, for the modules that build and actually have useful documentation. That seemed to me to be depressingly uncommon.

My experience is that the Perl community documents better than any other scripting language community. Most everything is perldoc (which gets installed as man pages when install a cpan package) with clear examples right up front where you can see them.

And that's not even talking about the built-in documentation. Even in 1994-5 when I first learned Perl, I learned it completely from the Perl man pages and not from a book. The man pages are comprehensive, easy to read, and organized well for reference.

Ruby, Python, PHP and Node really need to get their act together and follow Perl's lead in this area.

Re: Perl is 26 Today

#166

Earlier quoted context omitted.

thanks for the links. A question: How long before testing ends? 2014 or 2015?

Huh? I either don't understand your question, or whatever you are implying has gone right over my head.

sorry, I read again. My bad. It said 'Not yet another'.. got confused .. thought its still not out yet or something :(

Re: Perl is 26 Today

#167
post #156

Earlier quoted context omitted.

I guess the issue is the full version of the quote: "If you can't imagine different use profiles that make certain multi-processing paradigms better suited than others, then you shouldn't be having this discussion" That was the first time you've proposed the topic! I didn't imagine it because you hadn't actually brought up the subject. I asked you specifically what you needed. And already you've told me not to speak…

I was hoping to get you to be creative and come up with your own problem/solution pairs. :) Anyhow, rather than having you both take my word for it, and at the same time try to prove how bad i am at argumenting (i really am terrible!), i'd prefer to see you actually try a minecraft clone in multiple processes, just in case i'm wrong.

You wanted me to come up with a scenario like gaming graphics pipelines in a discussion of Perl, a language primarily used for Unix scripting tasks?

OK.

Re: Perl is 26 Today

#168

Earlier quoted context omitted.

Unfortunately -- and this is one of the many "banana peels" in Perl 5 -- even a simple statement like print x if x > 5 is problematic in p5 for a whole bunch of reasons: (1) At a bare minimum, what you really need to say is: print "$x\n" if $x > 5; That extra "\n" is a definite turn-off to a lot of people when the get their very first look at Perl. Really, the default these days should be more "say"-like. Of course,…

This is because it is by no means obvious as to which of the more "active" parts of the original expression Isn't it? If someone told you, really you to do just that, would you actually have a problem carrying out that command given a way to print something, a container, and a value to check against the container contents? Also, here's me preference: say $x if $x and $x > 5; Need to catch zero? say $x if defined $x a…

If someone told you, really you to do just that,

The problem here is that's just one way (in linguistics: "voice") in which the statement can be parsed. Another way is to look at it mathematically:

    print 
where

    expr := x if x > 5
which of course has an entirely different meaning.

What compounds the difficulty is that in general it's really difficult to anticipate all of these syntactical corner cases through a careful, a priori study of the man pages, or any of the available introductory literature. The only time-effective way (for most people) to get up to speed in a new language is through practice. Supplemented of course through book & occasional man page study. But really the way most people learn is programming is "by doing."

Which, sadly for Perl 5, means "by shooting yourself in the foot", in the prolonged early learning phase, for most people.

Re: Perl is 26 Today

#169
post #167

Earlier quoted context omitted.

I was hoping to get you to be creative and come up with your own problem/solution pairs. :) Anyhow, rather than having you both take my word for it, and at the same time try to prove how bad i am at argumenting (i really am terrible!), i'd prefer to see you actually try a minecraft clone in multiple processes, just in case i'm wrong.

You wanted me to come up with a scenario like gaming graphics pipelines in a discussion of Perl, a language primarily used for Unix scripting tasks? OK.

a language primarily used for Unix scripting tasks?

I wouldn't say that's necessarily an accurate description, or at least not a foregone conclusion.

Re: Perl is 26 Today

#170
post #167

Earlier quoted context omitted.

I was hoping to get you to be creative and come up with your own problem/solution pairs. :) Anyhow, rather than having you both take my word for it, and at the same time try to prove how bad i am at argumenting (i really am terrible!), i'd prefer to see you actually try a minecraft clone in multiple processes, just in case i'm wrong.

You wanted me to come up with a scenario like gaming graphics pipelines in a discussion of Perl, a language primarily used for Unix scripting tasks? OK.

I just told you that i exactly did not want you do to that:

> I was hoping to get you to be creative and come up with your own problem/solution pairs. :)

Also:

http://www.youtube.com/watch?feature=player_detailpage&v=R5F...

https://dl.dropboxusercontent.com/u/10190786/your_perl_on_dr...

Both done in realtime in Perl.

Also, oh god, all that stuff you edited into the reply before that one about LARTing and whatever, you're misinterpreting so much and putting so many words into my mouth, it's not funny anymore. You should try to reread my posts with a conscious effort to not make them sound like a german drill seargant yelling at you. ;)

Post reply on HN