Live data from Hacker News

Perl 7 is going to be Perl 5.32, mostly

perl.com

351–360 of 573 posts

Re: Perl 7 is going to be Perl 5.32, mostly

#351

I was part of a team that wrote significant parts of Amazon's payment processing systems in Perl in the late 90s. I really loved the language. It's object system was so flexible and powerful. Once you understood how write idiomatic perl. It was a joy to use. I'm looking forward to trying out Perl 7.

I hear Perl has weak typing with implicit type conversion. The only other language I know that has a powerful implicit type conversion system is C++. How does implicit type conversion work in Perl?

There is also a concept of "context" in Perl.

An operation may be evaluated in list or scalar context. For example, if you evaluate an array in list context, you get the members of the array, however, in scalar context, you get the number of elements in the array.

This idea is generalized to discuss different evaluation contexts for scalars. You might hear people discussing how a value behaves in boolean or string context. It's also common to talk about casting as "-ification", for example casting something to boolean context is "boolification".

By default, undefined values convert to empty string and 0. However, this can be made to generate a warning or even a fatal exception by setting the appropriate pragmas.

Re: Perl 7 is going to be Perl 5.32, mostly

#352

I've been a perl zealot since 2005. I didn't even know "python" existed until around 2008 when I found a script file with a ".py" file ending in a fresh ubuntu install. I started going to perl conferences sometime after 2010 when someone on irc informed be about them. I learned so much in those conferences, mainly about the alternatives to cgi and the modern OOP "framework" named "moose". I thought I was in heaven. I…

> it is not the notorious "write only" language that many troll it to be

I dispute that.

I have worked with many languages, and Perl has always been one of the hardest to remember due to non-standard symbol abuse and a few strange semantics.

There is a reason it has that reputation.

Even writing it isn’t easy. I can describe the Python syntax after years of not using it. Perl? No way I remember it.

Re: Perl 7 is going to be Perl 5.32, mostly

#353

Perl has these tiny neat features that I still miss in other languages. Like unless (opposite of if), and postfix syntax. print "It worked!\n" unless $error; print "Item: $_\n" foreach @items;

I spent much of my career working primarily in Perl. Now I use it when messing around with older codebases, but not for new work. However, I still use it pretty often for one-liners because of these neat features. For instance:

    perl -E 'say for grep {/o/} @ARGV' one two three

Re: Perl 7 is going to be Perl 5.32, mostly

#354
I'm sorry if this offends. But a complete laypersons* perspective from someone who hasn't been keeping up on the current perl ecosystem is this: perl6 failed to the degree that perl 5 became perl 7, while all the perl programmers switched to ruby or python. Am I wrong?

*ok, not completely layperson, I used perl a lot a decade ago an have spent a week playing with raku at one point, but nothing in my professional life even has a slight smell of perl anymore, which is strange seeing as 90% of our company codebase was perl 15 years ago.

Re: Perl 7 is going to be Perl 5.32, mostly

#355
post #271

Earlier quoted context omitted.

Friedl's masterpiece was my introduction to server-side programming in 2000. I'd been doing front-end for a few years with Dreamweaver and I was looking-up it's find & replace features in "Dreamweaver Bible 8" where regexes were mentioned as the ultimate weapon. "Mastering Regular Expressions" was referenced in a footnote and fortunately my local library had a copy. My mind was blown. Regex symbols were just so power…

Recently I found some old floppy drives at the back of a drawer. I manager to find an usb disk drive, inserted the floppy, what do I find? Sure enough, Perl code I've written back in 2000! Indeed, those were the days :)

If it was back-end website code it probably used Lincoln Stein's CGI.pm module which was used everywhere though it was a bit of a beast with frequent security updates. I later progressed to CGI::Application for an app which ran a business for 12 years before I converted it to Rails. I always thought Mojolicious was a great Perl web framework but unfortunately it landed just as Rails was picking-up steam.

Re: Perl 7 is going to be Perl 5.32, mostly

#356

Earlier quoted context omitted.

Perl was my first encounter with regular expressions. To this day, no language I've used does it better and cleaner. This includes Python, Boost/C++, Java, JavaScript, LISP, Go and Rust.

I do recommend Haskell. (But do not go into regexes first!) But even though it has a similar powerful set of operations for regular expressions, people mostly don't use it, because there are better ways to deal with text.

Funny you should mention Haskell as it was used to bootstrap one of the early versions of Perl 6 if I remember.

Re: Perl 7 is going to be Perl 5.32, mostly

#357
post #102

Earlier quoted context omitted.

I've heard Python's object system isn't that different under the hood.

My understanding was that Perl's OO system was directly inspired by Python's. I can't find a source on that though.

Other way round I think.

Re: Perl 7 is going to be Perl 5.32, mostly

#358
post #317
post #210

Earlier quoted context omitted.

It doesn't account for anywhere near the whole difference, but in a tight loop like that Python's going to be spending a good chunk of its time re-compiling the regex from the raw string literal every iteration. Hoist the regex definition out of the loop like so and it'll probably run about 30% faster: #!/usr/bin/env python3 import re with open('logs1.txt', 'r') as fh: regex = re.compile(r'\b\w{15}\b') for line in fh…

With pre-compiled regex the Python version comes down to 1.483s on my machine which is still considerably slower than Perl. I wrote versions of these using substring `index` instead of a regex and Perl was still the clear winner: time ./index.pl 0.258s time ./index.py 0.609s If you factor-in that Python startup time is 0.279s slower than Perl the processing differential comes down to 0.072s.

I'd be curious on your take of my code below, I have python and perl as dead even if you don't print and ignore pythons startup time.

Re: Perl 7 is going to be Perl 5.32, mostly

#359
I write perl professionally as of June 2020 (and I have been writing software in Perl since 1999). Never felt the need to use Python, or any other language for anything I do.

People who use my (mostly) Perl based software on AWS and GCP Marketplaces today are somewhat surprised and/or even taken aback when they find out it is written in Perl. So, I try not to mention that.

Re: Perl 7 is going to be Perl 5.32, mostly

#360
post #338

I've been a perl zealot since 2005. I didn't even know "python" existed until around 2008 when I found a script file with a ".py" file ending in a fresh ubuntu install. I started going to perl conferences sometime after 2010 when someone on irc informed be about them. I learned so much in those conferences, mainly about the alternatives to cgi and the modern OOP "framework" named "moose". I thought I was in heaven. I…

Python? That doesn't make sense. Anyone who appreciates Perl would surely choose Ruby over Python.

As someone who has worked arguably a lot with Perl, Ruby and Python, I too choose Python.
Post reply on HN