News for hackers. Stuff that matters.
Re:Perl 7 is going to be Perl 5.32, mostly by staycoolboy on Wednesday June 24, 2020 @01:44PM (#23631273)
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.
Re:Perl 7 is going to be Perl 5.32, mostly by aduitsis on Wednesday June 24, 2020 @02:27PM (#23631904)
Favorite syntactic sugar feature: the /x modifier which makes the regex ignore spaces and comments, meaning you can break your regex into multiple lines and comment them.
Re:Perl 7 is going to be Perl 5.32, mostly by staycoolboy on Wednesday June 24, 2020 @02:39PM (#23632085)
Have you ever read O'Reilly's "Mastering Regular Expressions" by Friedl? He does a deep dive into the weird guts of regex modifiers.

I was obsessed with that book one summer and wrote a bunch of parsers after learning incremental techniques (/o I think), and then 8 months later I could no longer remember how anything that I wrote worked. Lol me.

Re:Perl 7 is going to be Perl 5.32, mostly by cutler on Wednesday June 24, 2020 @03:48PM (#23632996)
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 powerful and the examples were mainly written in Perl which added even more power to them. The book was part of O'Reilly's Perl bookshelf so in addition to Friedl's book I bought the other Perl classics - "Programming Perl", "Perl Cookbook", "Mastering Algorithms with Perl" and "Learning Perl". With CPAN downloaded to my local disk I felt like a hitch-hiker setting out on a journey around the world needing nothing more than Perl in my backpack. Those were the days. Now I have to download 200Mb of node_modules before I can get started.
Re:Perl 7 is going to be Perl 5.32, mostly by aduitsis on Wednesday June 24, 2020 @04:00PM (#23633149)
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 :)
Re:Perl 7 is going to be Perl 5.32, mostly by cutler on Wednesday June 24, 2020 @05:51PM (#23634278)
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 by lizmat on Wednesday June 24, 2020 @03:53PM (#23633053)
FWIW, this is the default in Raku regular expressions.
Re:Perl 7 is going to be Perl 5.32, mostly by aduitsis on Wednesday June 24, 2020 @04:07PM (#23633230)
Oh, thank you, didn't know that!
Re:Perl 7 is going to be Perl 5.32, mostly by staycoolboy on Wednesday June 24, 2020 @05:36PM (#23634154)
Raku is Perl programming language so that makes sense.
Re:Perl 7 is going to be Perl 5.32, mostly by lizmat on Wednesday June 24, 2020 @03:09PM (#23632457)
If you're interested in improved regular expressions, I wuold suggest you have a look at Raku's regular expressions and grammars (formerly known as Perl 6): https://docs.raku.org/language/regexes
Re:Perl 7 is going to be Perl 5.32, mostly by laichzeit0 on Wednesday June 24, 2020 @03:00PM (#23632350)
Agreed. Regex is a “part of the language” not a bolt on library like you have in Python. It’s one of those cases where you don’t even know how crap regex is in another language if you’ve never used Perl.
Re:Perl 7 is going to be Perl 5.32, mostly by staycoolboy on Wednesday June 24, 2020 @07:05PM (#23634882)
I mentioned Boost's Regex in C++ (boost is essentially a different language), but I didn't bother to mention my experiments with regex in C, for example:

http://web.archive.org/web/20160308115653/http://peope.net/o...

I mean, you can do it, it just lacks elegance. And TBH, I still prefer C for lots of things.

Re:Perl 7 is going to be Perl 5.32, mostly by sysread on Wednesday June 24, 2020 @03:07PM (#23632436)
You should check out janet-lang.org. It's got built in peg parsing.
Re:Perl 7 is going to be Perl 5.32, mostly by freedomben on Wednesday June 24, 2020 @02:06PM (#23631597)
Awk and Ruby aren't on your list, any experience with those that you could compare/contrast with Perl?
Re:Perl 7 is going to be Perl 5.32, mostly by staycoolboy on Wednesday June 24, 2020 @02:42PM (#23632126)
Awk is very similar in syntax, but doesn't provide the sophistication of match vs subst, and doesn't support suffix modifiers.

I only used Ruby briefly over 20 years ago so I can't comment.

Re:Perl 7 is going to be Perl 5.32, mostly by marcosdumay on Wednesday June 24, 2020 @04:50PM (#23633708)
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.

Re:Perl 7 is going to be Perl 5.32, mostly by cutler on Wednesday June 24, 2020 @05:53PM (#23634295)
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 by gbacon on Thursday June 25, 2020 @01:58AM (#23637345)
Re:Perl 7 is going to be Perl 5.32, mostly by totalperspectiv on Wednesday June 24, 2020 @07:55PM (#23635252)
You would like Crystal, it has similar regexes