Live data from Hacker News

Half My Life with Perl

perladvent.org

111–120 of 139 posts

Re: Half My Life with Perl

#112

Earlier quoted context omitted.

I believe Perl got Unicode to a usable state long before Ruby. Ironic, given Ruby's origins.

It's not a race. Perl got there fast by basically not giving a damn about anything. Perl (talking about Perl 5, don't know anything about Raku, don't want to know anything about Raku) simply treats strings as sequences of numbers without requiring numbers to be in the 8-bit range. This makes it easy to say that those numbers could in principle be Unicode codepoints. The problem is that the actual assumptions about wh…

I've had the complete opposite experience. If I need to do more with non-ascii text then treat it as an opaque blob, I still haven't found anything better or easier than perl to do it in.

Re: Half My Life with Perl

#113
post #78

Earlier quoted context omitted.

Plain perl: open my $fh, ' Nicer: use File::Open qw(fopen); ... my $fh = fopen $filename; (and File::Open is simple pure perl code so if I need to distribute the script to random machines I throw App::FatPacker at it to produce a bundled version)

"my $fh" works fine if you only want to work with files you open() yourself, but what if you want to write a function that, based on some test, returns either that or the preexisting STDOUT filehandle?

    sub foo {
      if (whatever) {
        open my $fh, ...;
        return $fh;
      } else {
        return \*STDOUT;
      }
    }
will do the job.

Re: Half My Life with Perl

#114

Earlier quoted context omitted.

"my $fh" works fine if you only want to work with files you open() yourself, but what if you want to write a function that, based on some test, returns either that or the preexisting STDOUT filehandle?

sub foo { if (whatever) { open my $fh, ...; return $fh; } else { return \*STDOUT; } } will do the job.

Thanks. I feel certain that I tried exactly this a long time ago, and it didn't work as expected, but I may be misremembering. I'll give this a shot the next time I'm in front of a keyboard -- if it works, it will be nothing short of healing.

Re: Half My Life with Perl

#115

I’m about to turn 40 and have been thinking if I should learn Perl or AWK or go with a “modern” solution for text wrangling on the command line. The general advice here seems to be “learn Perl while young”

I think you would really have needed to learn Perl in the 1990's.

Perl had three huge advantages (at least for me) when I first used it in 1992: 1: familiar syntax which paralleled well-loved tools (sed, troff, grep) 2: associative arrays as a built-in 3: regular expressions as a top-level language feature (not buried in some library with clunky syntax). A few years later, CPAN was another huge advantage.

Nowadays, syntax compatibility with sed is a disadvantage not advantage, associative arrays/dictionaries exist or are easily available for basically every language, and CPAN was the model that everybody else copied or did better. So really the "regexp syntax is immediately available" is the only remaining advantage, and it's rare that it would be worth it.

Re: Half My Life with Perl

#117
post #95
post #7

Earlier quoted context omitted.

Raku is basically perl 6 and has some features that blew my mind when I tried it a few years back. Never really did much with it, but it was enjoyable to learn.

This encapsulates every conversation I have ever had with someone who tried Perl 6: Tried it, was blown away with [some aspect of it], never found anything practical to do with it, never used it again.

I think I even reference that in the talk... Dart is everything I wanted from Perl 6, which is why I'm happy to be coding in Dart now.

Re: Half My Life with Perl

#118

Earlier quoted context omitted.

I agree with you that it is sad there isn't more diversity in languages and tools, and that generally organizations are using the same terrible slop. We could have such nice things You lose me with the smugness. Make no mistake, you aren't smarter or better than someone else purely by virtue of your willingness to hack on BEAM languages or smlnj or Racket or whatever languages you like. There are probably people smar…

That sounds like post facto rationalization, sour grapes, and perhaps a bit of learned helplessness. To paraphrase you ‘We can’t have nice things because nice things are in reality bad and unrealistic. People who do have nice things are not special.’ I could readily believe that your stated reality is true of the majority of solo devs, but it’s not true for me or those that I know. I understand that my sampling is bi…

It's not learned helplessness et al, just a plea to drop the smug elitism if you want people to take you seriously. I actually want nice things, I hate writing brittle systems in languages that offer no meaningful guardrails, and setting up Rube Goldberg contraptions to get a poor approximation of e.g. basic BEAM runtime functionality.

Any success I have had in getting very boring companies to adopt nice things at all has not come from insulting people's intelligence and acting like I'm the smartest person in the room. I despise this kind of elitism that is rampant in certain technical communities. It turns people off like nothing else and serves no purpose other than to stroke your own ego -- it's pointless meanness.

Re: Half My Life with Perl

#119
post #41

Earlier quoted context omitted.

What's the modern solution to text processing on the command line? I don't think anyone tried seriously addressing that use case after Perl. Like, obviously you can do text processing in any language, but you're not going to be doing it in the context of shell pipelines and one-liners. The preferred interaction modes are totally different.

That was bad phrasing on my part, I meant "Is there a modern alternative I should go with instead?" - I also don't know what it would be. But I would love to know if there is a non-regular expression language with native support for csv, json and yaml that one can pipe files in and out of.

Not exactly what you're looking for, but you'd probably like looking at miller / mlr. https://github.com/johnkerl/miller

Re: Half My Life with Perl

#120

Earlier quoted context omitted.

That sounds like post facto rationalization, sour grapes, and perhaps a bit of learned helplessness. To paraphrase you ‘We can’t have nice things because nice things are in reality bad and unrealistic. People who do have nice things are not special.’ I could readily believe that your stated reality is true of the majority of solo devs, but it’s not true for me or those that I know. I understand that my sampling is bi…

It's not learned helplessness et al, just a plea to drop the smug elitism if you want people to take you seriously. I actually want nice things, I hate writing brittle systems in languages that offer no meaningful guardrails, and setting up Rube Goldberg contraptions to get a poor approximation of e.g. basic BEAM runtime functionality. Any success I have had in getting very boring companies to adopt nice things at al…

I worked applied research at a few very big companies and did have a measured amount of success getting some advanced tech adopted so I know what it takes to move the needle. My lesson, and one I wish I learned sooner, was that the effort was not worth it. I had assumed that the lack of adoption was due to lack of exposure to ideas but having exposed these ideas to a large number of people I reluctantly came to the conclusion that it more of a lack of innate intelligence. I honestly wish it wasn’t so.

My goal has not been to fix big companies for a long time, I was just musing on the rational and commented to see what other people think on the topic.

Post reply on HN