If perl is so amazing for string manipulation then why is it so hard to fin a good way to check if a string is...

if perl is so amazing for string manipulation then why is it so hard to fin a good way to check if a string is contained in an array in perl?
python is
a = [1,2,3,4,'a','b','c']return 'a' in a
where as in perl its
$x = "cat dog dog house"; # 3 wordsmy $element = "dog";if( grep{$_ eq [email protected]/* */){ #todo}
fucking stupid

Other urls found in this thread:

rosettacode.org/wiki/Search_a_list
metacpan.org/pod/PPI
gist.github.com/briandfoy/3063641.
twitter.com/NSFWRedditGif

$x = "cat dog dog house"; # 3 words@words = ($x =~ /(\w+)/g); # matches,my $element = "dog"if( grep{$_ eq [email protected]/* */){ print "two dogs"}

use List::Util qw;return any { $_ eq 'a' } @list;
Much hard. Very spoonfeed. Reddit.

perl version: completely unreadable
python version: completely readable
why is perl such unreadable trash?

it isn't the fault of the language that you are a retard

that is the ugliest syntax I have ever seen

Show us your perfect readable language from rosettacode.org/wiki/Search_a_list

Yeah that's right, fuck off back to freech. Cowards.

< "string manipulation"
pajeet pls

Don't be a retard. You can match on word boundaries and use goatse operator if you just want a count.
my $x = "cat dog poo pee"; say "match" if $x =~ /\b cat \b/xg;my $c =()= $x=~/\b cat \b/xg; say "count $c";

Old oldfag here. You should see ooperl if you want to see it go completely unreadable, or even non-trivial data-structures. We were so goddamn happy to be rid of perl, way more so than with tcl.

Fuck off. Perl has a great OOP.
Moose is one of the best OO system available. It's directly based on CLOS.
Python OOP is Java-like crap.

If you were doing OOP in bare Perl, either quit complaining or consider yourself a retard.
You can do OOP in both C and bare Perl, but you should know what you are doing.

Speaking of CLOS, one should think of Perl as a Lisp language with a non Lisp syntax.

This is an example of how Lisp handles stuff. `any` is a higher-order function and you pass a lambda function to it.

This is how niggers do it, by adding keywords.

It was so great that we all abandoned it, huh kiddo?

My guess is you all were just a bunch of mongoloid retards.
If you can't write readable code in Perl, you can't write it in any other language either.
Python code would just look more readable for you, but in reality it'd be just as crap.

Moose is still active, and theres like 5 other flavors of OOP packages in perl too.

We have a different idea of what abandoned means. Vast amounts of software used to be written in perl and ooperl and you needed to know it to be hired for most jobs on UNIX. Even many Windows jobs required it. Internal projects in the 100k+ LoC range were normal. Things are quite different today.
While I'm sure there are still people poking around with it just as they do haskell, D, and brainfuck, the days of millions of lines of it pouring out of people who actually get shit done are long gone.

Its sad that Ruby's reputation was ruined by RoR hipsters. Ruby is just the good parts of a Perl with one of the best OOP systems.
a = %w{1 2 3 4 a b c d}a.include? "a"

Ruby was a mediocre also-ran that was /saved/ by RoR hipsters. It went nowhere for years until rails.

read my comment again

tcl is still going strong in the vlsi industry

my @q = qw(foo bar);if ("bar" ~~ @q){ print "yes\n";}

Perl 6 has junctions for it.
say "yes" if "bar" eq any @x;

fucking rapist piece of shit. do you know that 1 out of 3 women will get sexually assaulted in their lifetime? probably not because you are a straight white male.

All these newer scripting languages from Python and on are pretty awful. Even old school BASIC is better.

Your thoughts on Perl?

Can Perl gracefully manipulate Perl code as data?
No?
Then it's not a fucking Lisp language.
Not everything has to be a Lisp. I've seen people claim that Javascript is a Lisp, that Python is a Lisp, that Ruby is a Lisp, and now that Perl is a Lisp, but they really aren't. You can do Lispoid things with them, but they miss Lisp's fundamental property.


If I get someone's shitty Python code I have a much better chance of figuring out what the code does, figuring out what the code is supposed to do, and fixing it. It's going to be shit either way, but if it's readable I might be able to work with it.

Yes, it can. metacpan.org/pod/PPI
For example, you can find dead code quite easily with it gist.github.com/briandfoy/3063641.

If you mean homoiconicity by "fundamental property".
Perl 6 has it the way Julia does.

It's not readable, it appears to be readable. Python code can be line-noise too, especially OO code with all of this "dunder" retardation. And if you're not an idiot, you can understand what code does even if it was an IOCCC winner.
For example, this famous one-liner
perl -e '$??s:;s:s;;$?::s;;=]=>%-{

That's not enough. Python has that too, as the ast module in the standard library. The keyword here is gracefully. In Lisp, code and data have the same structure. When you treat code as data it becomes the same sort of list you'd use for data structures that don't take advantage of homoiconicity. The tokens you get back are actually just the same kind of symbols you would use in regular code. And so on. You don't need to do anything complicated to treat code as data because the code is fundamentally simple, and that's what makes Lisp special.
Things like PPI are useful, but can you really compare Lisp to something with a "PPI::Token::Whitespace" with a straight face?
Comparing Julia to Lisp is more reasonable, though.

Dunders don't have the readability problems of Perl. They're slightly less terse than the obvious alternative, while Perl's problems are extreme terseness and having many ways to do the same thing.
Can you show me some Python line-noise?

I've got bad news for you - real life badly written complicated code usually does complicated things internally instead of resolving into a state where you can safely ignore most of it. Your example is irrelevant.

It's the fault of the language to be unreadable with such trivial task.

No matter what i show you, you will claim it is not line noise and easy to read for someone accustomed to python.
You are biased and won't accept any answer, admit it.

You haven't shown me any example yet, so that's a suspiciously strong claim to make. Your prediction would match either of me having a bias or Python actually being more readable than Perl.
Look, Python is known for being readable, to the point where a lot of the most common Python criticisms are of design decisions that were taken for the sake of readability. I think it's a defensible position (although not one I agree with) that Python is too readable. Perl is notoriously unreadable, and I also think it's a defensible position that making it more readable would make it lose a lot of its power. Perl is less readable than Python. That doesn't automatically make it a worse language, but "Python is as unreadable as Perl" is just a ridiculous position to take.

The main criticism is that vanilla python is dogslow

That's one of them, but Python's use of whitespace is definitely in the top three, and I often hear complaints about, for example, its ternary operator.

I thought so too before I saw Rust.

kek

go away.

let rust_rocks = ["rust", "is", "the", "shit"];rust_rocks.iter().any(|&s| s == "shit");

oh slices have a contains function.
let rust_rocks = ["rust", "is", "the", "shit"];rust_rocks.contains(&"shit");

If python is so amazing for having one correct way to do things why are the users spread across five different incompatible versions?

You mean two. Python 3.0+ to older Python 3 versions is heavily backwards-compatible, and has only broken it in very minor ways that hit almost nobody, and Python 2.7 is always the same, with some occasional additions.

Literally worse syntax than perl

B R A V O

...