Perl is magic

is perl the only magical programming language?

hasn't Perl been replaced by Python for most tasks?

...

...after 50 fucking attempts at getting it to werk

This degree of lack of self-awareness is truly incredible.

Python is modern therefore is nu-gay, but Perl was used by actual early-FOSS, who were overwhelmingly homosexual.
Magic isn't "doing what you want", Magic is "doing the previously impossible". Perl is like Meccano. You can do what you want, but it'll cost you big time.

...

Yes. It's too popular for Holla Forums, though. Normies use it, reeee.

A programming language is only as good as the programmer. Perl lets you do a lot with it's syntax but that just means that retards have more of a reason to do something stupid.
I use perl because it makes regular expressions tolerable.

It's like shell, except you can actually us it for programming too.

I'll stick to unironically writing programs in Scheme, the true programming language for wizards.

But python is used by gnomes, and ruby is used by e-celeb webdevs. Perl doesn't have nearly as much of a retard problem as either of those.

What does Perl let me do that Python doesn't (easily)?
Its regex handling seems more convenient, but it's not enough on its own to make me learn Perl. Is there more like that?

They're very similar languages. Anything that can be done in one can be done in the other just fine.

As far as the differences go, the biggest one is how Perl handles functions. C and most languages:int increment(int x) { return x++;}increment(5); // 6Perl:sub increment { my $x = shift; return $x++;increment(5); # 6}
Perl's approach to function arguments is like how normal programming languages deal with command line arguments. It sticks them in an array accessible within the code block. The array is called @_, but you don't need to know that to work with arguments.
Perl's shift command takes an array, and returns the first item in the array. It also removes the item from the array. It has a neat feature where if you don't give it an argument it'll assume you mean @_ if you're in a function definition or @ARGV otherwise.

If you want some proper reading for Perl, look for the book Programming Perl, from the o'reilly series. It's a little old, but everything in there is still relevant. The preface and chapter 1 should be enough to get a feel for Perl. Also note this is for Perl 5. There is a Perl 6, and it has loads of neat features, but it's not mature enough to get widespread use quite yet

wizard trips confirm wizardness, thank you oh enlightened one for sharing your thoughts

The way perl handles regex is more than enough reason to switch. Python regexes are pure cancer and perl regexs are pure noice.

So if a function doesn't read an argument it just stays there?

If you call a function with arguments, and don't use the arguments, nothing happens. Same as running a program with arguments when it doesn't do anything with argv.
If your function doesn't need arguments, you don't need the "my $x = shift;" line
@_ is only valid for the code block it's in. You can't give one function arguments, then call those arguments from a different code block.

Cope with user input. Python (and perl 6, mind you) have separate binary and text types, and one of the two is invariably totally fucking useless and neglected.

That's certainly a problem with Python 2, but Python 3 doesn't give me any trouble. It's pretty sane. Can you elaborate?

regexes are pure cancer. There's a reason why they're not used much anymore. Try writing one to validate an email address 100% accurately covering every edge case.

The main reason we abandoned Perl was its extreme autism about having a million different possible ways to solve a problem leading to a goddamn biblical tale of Babel trying to get multiple programmers to work together effectively. Since you're mostly disgusting millennials you didn't get to experience that, but you can live through it vicariously - try to add a feature to bugzilla that cuts across the codebase. Tour hell, in other words. And since you'll likely say something incredibly naive like, "but this situation was the fault of Perl programmers, not Perl!", know that we got tired of that bullshit excuse on every fucking Perl project and moved to a language where for whatever reason you're comfortable with it doesn't happen.

That's just not something you should use regexes for, because e-mail addresses are actually pretty complicated. They're at the edge of what a finite-state automaton can do.
That doesn't make regexes an invalid choice for all other tasks.

The problem with Perl is people mistaking it for a "real" programming language and using it for serious projects. Treat it like shell add-on, to, occasionally, enhance shell scripts, and it will serve you just fine.

They're quite simple, see page 29 of RFC 821. That's about 20 BNF rules. Only takes a couple minutes (with experience with the tools) to build a perfect validator with flex/bison. With regexes, it's likely impossible. Even a regex that gets close is essentially distilled madness.
There are almost no cases I've seen regexes used where they weren't an 80% solution. Email address validation, HTML header parsing, practically any use with UNIX utilities, etc.. Pick a program, grep for a regex, then see if you can come up with edge cases that break it. You might be surprised at how fragile they are in practice. It's better for correctness to just ban their use since they're almost never used well, and I've worked at several companies that do that.

Oh really? What do you use instead?

Haskell parser combinators.

Parser generators.

Full retard.jpg

There's a quick way, and a proper way for everything, Pajeet.

You're the kind of person that required us to ban regexes.

^[-a-z0-9_.][email protected][-a-z0-9_]+.[-a-z0-9_]+

file mails:[email protected][email protected],valid}[email protected]other_[email protected][email protected]grep '^[-a-z0-9_.]\[email protected][-a-z0-9_]\+.[-a-z0-9_]\+' mails[email protected][email protected]_[email protected][email protected]

...

The RFC about email validity has some serious fuckery to consider, if you want to be complaint. You can do it with regex, sure, but it's going to be closer to a page than a line. Quotes and escaped characters? Things you'd normally consider mandatory being absent? Spaces in quotes? IP address instead of a domain, in angle brackets? Yeah, sure, that's valid.
For practical purposes, you can get by with something a lot simpler and restrictive, and such strictness is a good idea to apply to any email addresses you allow to create on your domain. That'd at least make it a lot more likely that anything out-going is accepted by those who don't bother following the RFC.

Because emails like
" hot @nal %'^$$%=nohomo"@[104.16.77.187]
are valid, common and probably have very important and useful communication for the majority of your userbase.

My Little Perl: Code is Magic