Live data from Hacker News

Perl 7 is going to be Perl 5.32, mostly

perl.com

481–490 of 573 posts

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

#481
post #152

Earlier quoted context omitted.

Perl is still unmatched for one-liners, and by extension, one-liners that graduate to short scripts.

Yes, of all the Perl books in my collection Tim Maher's "Minimal Perl" (Manning) is still the one I dip into regularly.

Thinking about this some more, I now feel really sad for anyone who doesn't use perl (i.e., almost everyone). Its immense power at the command line is something they'll never experience. Nothing today even comes close.

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

#482
post #394

Earlier quoted context omitted.

> 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. For example?

I mean, the combinations of $%@ are really astoundingly bad. $ alone has so many different meanings and operations depending on context. You won't find that sort of thing in any other language. Not even PHP which for some bizarre reason brought $ along for the ride. Here's a fun exercise, write a dictionary of arrays. Now write a dictionary of 2d arrays. In any other language, that's hardly a challenge to both read a…

> $ alone has so many different meanings and operations depending on context.

Used as a sigil, $ always tags a scalar, a single value.

    $foo = 3;
A reference to something else is a single value.

    $bar = [qw/ apple orange banana /];
The special variable $$ is the pid of the current process, borrowed from the shell. Special variables with punctuation names have length at most one. The leading $ is the scalar sigil, and the latter is its name.

Dereferencing a reference to scalar is rarely used and looks like either

    $$baz = $quux;
or

    ${$baz} = $quux;
In a regex, $ broadly means end of line, but the exact meaning is context sensitive: possibly end of buffer, just before a newline at the end of a buffer, or end of logical line within a buffer. Where it matters, the anchors \z and \Z have less flexible meanings.

Of those, the kinda fuzzy one is $ inside a regex. The rest follow consistent, simple rules. I’m not sure what you mean by different operations on $. Am I skipping a difficult case you have in mind?

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

#483
post #442

Earlier quoted context omitted.

> Ofc the Perl is going to look like garbage and not be maintainable Please stop perpetuating this myth. It really depends how you write it. Perl isn't going to do the tidying up for you, you'll have to properly structure the code yourself. If you still write Perl code like it’s 1991 then maybe itcs not maintainable. I work on a largeish Perl code base and I can assure you it's quite maintainable, moreso than most Js…

> If you still write Perl code like it’s 1991 then maybe itcs not maintainable. This is probably one of the issues with Perl. You can still write Python code like it's 1991 and it will still be readable and maintainable.

no you cant, cuz 2.x python wont work in 3.x ;)

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

#484

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…

> perl has been the same since 2002 if you ignore perl 6 then you might as well ignore python 3. And even still, python 2 is dead. There are only a handful of languages as well maintained as Perl 5. https://en.wikipedia.org/wiki/Perl_5_version_history Perl maintains strict backwards compatibility. I can run code that was written decades ago. I really am curious what features you think Perl 5 lacks. > Another issue is…

> I really haven't seen a single thing Python, Ruby, or PHP have done that much better.

explicit function signatures for one!

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

#485

Earlier quoted context omitted.

> Here's a fun exercise, write a dictionary of arrays. Umm … ok: my %dict = ( foo => [ 1, 2, 3 ], bar => [ 4, 5, 6 ], ); > Now write a dictionary of 2d arrays. my %dict2d = ( foo => [ [1, 2, 3], [4, 5, 6] ], bar => [], ); It’s pretty much identical to JS. Not sure how that’s supposed to exemplify how hard it is to write Perl.

I'm not the original comment author, neither am I fluent in Perl. But I suspect they meant nested hashes and not a hash whose values are arrays of arrays. As you point out, the latter is trivial. To be clear, even a nested hash is all well as long as the depth and the keys are literals (as in your example). It is when keys are dynamic that things get unruly. And god forbid if the _depth_ of nesting is dynamic. All of…

    %nested = (foo => { bar => { baz => "quux" } });
Access the leaf with

    $nested->{foo}{bar}{baz}
If the keys are in variables, it becomes

    $nested->{$x}{$y}{$z}
For dynamic depth, do you have a specific use case in mind? If I have a tree, I’m probably going to search it rather than using a hardcoded path.

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

#486

Earlier quoted context omitted.

Both. Perl is around 20x slower than C for common tasks, while Python is around 133x slower than C for common tasks like looping, depending on what you're doing of course. Perl is the ultimate mockup language in that you can crank out code very fast and get good bug free results. It lets you write in the way you think where other programming languages force you to write a specific way. Ofc you can get good at Python,…

I don't think your performance numbers are very accurate. I've done a bit of Perl and a lot of Python and they're fairly comparable in most cases. Python is lightning fast for a lot of scripting tasks and I generally use very few libraries for day to day tasks because the Python stdlib is so good. Unless you're doing something really simple with Perl command line switches that operate over an entire file, I'd bet Per…

No, his estimates look pretty accurate to me. I've also done a fair bit of both Perl and Python (including working with the internals in C).

Perl is significantly faster than Python for many types of common string manipulation tasks. They're both fast, sure, but Perl has some key optimizations.

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

#487
post #424
post #377

Earlier quoted context omitted.

I took some similar benchmarks recently: https://code.ivysaur.me/interpreter-binary-perf Perl5 won the dec2bin benchmark. The other thing I learned was that PHP's binary/decimal functions are two orders of magnitude slower, despite its core interpreter performance being best-in-class.

On the other hand PHP has a PCRE jit option which manages to beat even Perl's regex implementation.

Yes but you can use that jit also with perl5. https://metacpan.org/pod/re::engine::PCRE2

It has even less backcompat problems than the native regex.

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

#488
To be on topic:

Perl7 is basically the idea to modernize saner settings by default. And breaking backcompat where it hurts. But it's far off a modern perl, like cperl is. They failed to fix the worst historical design mistakes. The hashes, the OO, types, @_, attrs before signatures (which was a major breaking change, but they excused themselves by claiming it was experimental), and many more.

https://github.com/perl11/cperl/issues/414

Instead they are breaking indirect method calls. Thanksfully this will be not POSIX, so nobody will use it.

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

#489
post #356

Earlier quoted context omitted.

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.

Correct:

https://en.wikipedia.org/wiki/Pugs_(programming)

Post reply on HN