Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

We are sorry to see you leave - Beta is different and we value the time you took to try it out. Before you decide to go, please take a look at some value-adds for Beta and learn more about it. Thank you for reading Slashdot, and for making the site better!

Perl 5.11.0 Released

Soulskill posted more than 5 years ago | from the and-so-soon dept.

Perl 235

jamie points out that Perl 5.11.0 was released yesterday, as well as a schedule for future 5.11.x releases, planned for the 20th of every month. Jesse Vincent encouraged testing of the new (development) version, saying, "If you write software in Perl, it is particularly important that you test your software against development releases. While we strive to maintain source compatibility with prior releases wherever possible, it is always possible that a well-intentioned change can have unexpected consequences. If you spot a change in a development release which breaks your code, it's much more likely that we will be able to fix it before the next stable release. If you only test your code against stable releases of Perl, it may not be possible to undo a backwards-incompatible change which breaks your code."

Sorry! There are no comments related to the filter you selected.

Wow. . . (5, Funny)

ibmjones (52133) | more than 5 years ago | (#29627209)

It must be real good if it goes to eleven.

Re:Wow. . . (4, Funny)

Jeff DeMaagd (2015) | more than 5 years ago | (#29627903)

Is anyone hosting a Perl 5.11.0 House Party? Will there be deviled eggs?

Seriously? (2, Interesting)

bsDaemon (87307) | more than 5 years ago | (#29627217)

5.10.1 just came out like a week or so ago... there seems to be a slightly accelerated rate of Perl development lately, which is nice as it proves it's not a 'dead' language by any stretch... and with extensions such as MooseX::Declare, it really gives some of the more modern, OO-based dynamic languages like Python or Ruby a run for their money in their traditional sphere as well, I'd say.

and first post i think.

Re:Seriously? (0, Insightful)

Anonymous Coward | more than 5 years ago | (#29627347)

it's possible to actively produce a software package that no one uses. so new releases alone don't prove anything about whether it's a dead language.

to those of you for whom basic reasoning and reading comprehension are too much to ask, i did NOT just claim that perl is dead. I only claimed that the frequency of releases alone is not a criteria for determining its dead-ness or alive-ness. now seriously, go get some remedial education if you thought I was claiming it was dead, because no one needs your wanton ignorance polluting the Internet, driving, voting, and buying into all the bullshit the media spews every day.

Re:Seriously? (3, Funny)

rubycodez (864176) | more than 5 years ago | (#29627477)

no, proves instead of being dead it's stagnant. Perl 5.x lingers like scent of dead skunk under the porch while the Frankenstein of Perl 6 is still on the mad scientist's table, metaphorically getting body parts sewn on from morgues and cemeteries and hospitals across the globe. Perl 6 is the undead Creeper [wikipedia.org] of programming languages

Re:Seriously? (2, Funny)

causality (777677) | more than 5 years ago | (#29627587)

no, proves instead of being dead it's stagnant. Perl 5.x lingers like scent of dead skunk under the porch while the Frankenstein of Perl 6 is still on the mad scientist's table, metaphorically getting body parts sewn on from morgues and cemeteries and hospitals across the globe. Perl 6 is the undead Creeper [wikipedia.org] of programming languages

Where's BadAnalogyGuy when you need him?

Re:Seriously? (5, Informative)

ThePhilips (752041) | more than 5 years ago | (#29627629)

Uhm...

Perl 5 development is stagnant for one simple reason: Perl 5 is near perfect, there is nothing left to be developed there.

Some wanted better Perl with more consistent syntax. That's what Perl 6 is for. 5.10/etc are intermediate releases serving the purpose of facilitating future migration to Perl 6: some ambiguous constructs of previous version are gone in 5.10/etc.

I personally do not care much about 6th - I yet to find any pathological problem in Perl 5 which would persuade me somehow to move to next big thing. Perl 5 is well documented, has piles of modules and examples all over the net. I see no point to move from it.

Re:Seriously? (5, Funny)

iggymanz (596061) | more than 5 years ago | (#29627917)

and Perl use had dropped to 15% of its former level in the past five years because the perfect number of applications have been developed with it, there's almost no software left to write.

Re:Seriously? (3, Insightful)

ThePhilips (752041) | more than 5 years ago | (#29628285)

Benchmarks and whatnot have little relevance to the real world.

It's true that thanks to the "there is more than one way to do the same thing" isn't very appealing to commercial companies. But at the same time in the past 15+ years I work, literally every employer had some part of its infrastructure supported by Perl programs.

Perl isn't for everyone. Obviously simpler languages like Java or C# or Python would tend to dominate because barrier to entry is lower. Nothing new.

Perl dominated Web in the times when it was a new thing. Internet itself was a new thing. And obviously to start something new you need smart and experienced people. Among such people Perl tend to be quite popular. Now Web design became something what even your mom can do - tools are abundant. There is no need to employ such heavy lifting tools like Perl anymore.

But thinking that Perl was used exclusively to do web stuff is a rather silly mistake to make.

Re:Seriously? (0, Troll)

shmlco (594907) | more than 5 years ago | (#29628645)

Perl dominated the web back in the early days not so much because of its power or ability to do "heavy lifting", but because it was darn near your only choice for server-side development and scripting. This was pre-ASP, pre-CF, pre-PHP, and Ruby wasn't even a gleam in anyone's eye.

Perl is powerful, yes, but it's also complex, obtuse, and far surpases C in the obfusication department. The "smart and experienced people" abandoned it in droves the second easier to use and more productive tools became available.

I personally know of exactly one company that uses Perl at the moment, and that's only for text cleanup.

Re:Seriously? (1)

maxume (22995) | more than 5 years ago | (#29628791)

Ruby was first released in 1995, the web wasn't real old just then.

Re:Seriously? (0)

Anonymous Coward | more than 5 years ago | (#29628583)

There is always something left to be developed; you're just not imaginative enough.

Re:Seriously? (3, Informative)

Fnord (1756) | more than 5 years ago | (#29627667)

Its not an indication of anything. 5.11 is a development branch. In theory it should be released the moment they implement one feature that doesn't belong in 5.10.

Re:Seriously? (1)

coolgeek (140561) | more than 5 years ago | (#29628697)

The statement that they are unsure if they are going to break something is probably just the thing to kill it in my eyes. I have about 50,500 lines of perl running a production system, and this announcement has me seriously thinking I should port it all to a language I can rely on. I don't need a routine yum update breaking my system, and I sure as hell don't have time to test their code constantly.

Also try Perl 6 (4, Insightful)

Norsefire (1494323) | more than 5 years ago | (#29627229)

While you're being adventurous and testing Perl 5.11.0 I also suggest trying a Perl 6 implementation. Rakudo Perl [rakudo.org] (running on the Parrot VM [parrot.org] ) is one of the most actively developed right now. Not as solid as Perl 5.X yet, but certainly getting there.

Re:Also try Perl 6 (2, Insightful)

iggymanz (596061) | more than 5 years ago | (#29627701)

uh, I'd rather do an implementation in a language that's not in pre-release status. My clients like their money handled by language that 1. exists 2. has stable specification 3. has stable releases

Re:Also try Perl 6 (4, Informative)

Norsefire (1494323) | more than 5 years ago | (#29627751)

1. exists

People have been using Perl 6 for years now. It certainly exists.

2. has stable specification

"Stable" is a biologist term, it means "dead". The problem with a set specification (the "waterfall" model) is you discover after something was implemented that it was a bad idea, the whirlpool model prevents this.

3. has stable releases

Rakudo has a release every month. The "big" release is coming next April.

Re:Also try Perl 6 (-1, Flamebait)

Anonymous Coward | more than 5 years ago | (#29627819)

Who are these "people" using "Perl 6" for "years"? Name them now, please. The only people I know "using" Perl 6 are those who installed Rakudo, saw that it was a piece of cowshit, and promptly ignored it for being the excrement that it is.

And we aren't biologists, you faggot. We are software developers. And so we use the definition of "stable" that is commonly known to software developers, which has to do with predictability, a lack of changes that will break our code, and a robustness that'll help avoid crashes.

I don't give a fuck if Rakudo releases every month. My clients don't give a fuck. We want software that we can trust in to not rape itself. Perl 5 gives us that trust. Java gives us that trust. Even .NET gives us that trust. Perl 6 and Rakudo do not.

Re:Also try Perl 6 (2, Informative)

Norsefire (1494323) | more than 5 years ago | (#29627915)

Who are these "people" using "Perl 6" for "years"? Name them now, please. The only people I know "using" Perl 6 are those who installed Rakudo, saw that it was a piece of cowshit, and promptly ignored it for being the excrement that it is.

That's weird, because the number of projects known the proto perl6 module manager are increasing [perlgeek.de] . Rakudo is passing more spectests [rakudo.de] , and its commits are increasing [rakudo.de] . There's an entire IRC channel full of users on freenode in #perl6 is you want a list.

a lack of changes that will break our code

A stagnant and dead product gets no changes that will break your code. It is that simple.

I don't give a fuck if Rakudo releases every month. My clients don't give a fuck.

Maybe no one cares what your opinions about Perl 6 are? But here we are.

Perl 6 and Rakudo do not.

Really? Can you give examples of problems in Rakudo that would stop it being used in production? Didn't think so.

Re:Also try Perl 6 (1)

iggymanz (596061) | more than 5 years ago | (#29627981)

no No NO. partial implementations of a pre-release language in flux exist, people who need to write reliable real world applications aren't going to touch that with ten foot pole. Perl 6 is the HURD of programming languages, high school science project with some cool ideas here and there.

Re:Also try Perl 6 (1)

Norsefire (1494323) | more than 5 years ago | (#29628089)

partial implementations of a pre-release language in flux exist, people who need to write reliable real world applications aren't going to touch that with ten foot pole.

People only code in languages that never change?

Re:Also try Perl 6 (1)

Sir_Lewk (967686) | more than 5 years ago | (#29627877)

So clearly it's not targeted at you. Nobody cares.

Re:Also try Perl 6 (1)

iggymanz (596061) | more than 5 years ago | (#29627991)

clearly it's not targeted at anyone who writes real world scripting langauge applications. everyone cares since no one is using it other than as a fun diversion to fart around with ideas

Re:Also try Perl 6 (0, Troll)

outZider (165286) | more than 5 years ago | (#29628037)

I take it you're a COBOL programmer?

Other stuff that is out (5, Funny)

sakdoctor (1087155) | more than 5 years ago | (#29627293)

Kernel 2.6.31.1
PHP 5.2.11
Apache 2.2.13
Debian 5.0.3

Keep up with all those thrilling point released with slashdot.org

Perl has died in industry. (5, Interesting)

Anonymous Coward | more than 5 years ago | (#29627307)

For software of any appreciable size, Perl has unfortunately died in industry. People just aren't using it for anything more than 10-line throwaway scripts.

Perl 6 was something those of us in industry had been anticipating with glee. We expected it to modernize the Perl platform, and make it a contender against Java, .NET and C++ for large-scale software development. But we also expected we'd have that around 2005. It's nearly 2010, and we still don't see much real progress on that front. Rakudo just isn't a production-grade product yet.

I'm sad to admit it, but instead of waiting for incremental Perl 5 releases for the next decade until Perl 6 is finally mature enough, the company I'm with has started to migrate from Perl to Python. Unlike the Perl community, the Python community has shown with Python 3 that they're capable of working together to create a major release with many new features in a relatively short amount of time (especially compared to the Perl 6 effort).

Rewriting our approximately 3 million lines of Perl code into Python has actually gone reasonably well. Although I was a staunch defender of Perl, I do have to give Python its kudos. Every day it looks more and more like we've made the right choice moving away from Perl, and towards Python.

Re:Perl has died in industry (mod away, kids) (-1, Flamebait)

bitemykarma (1515895) | more than 5 years ago | (#29627421)

Ok, I know this will be modded flamebait or troll, but really. Think about why do these scripting ("dynamic", bah) languages come and go.

It appears to me that some kids don't want to mess around with compilers and such. They value programming speed over stability and maintainability. Don't think so? Look at a Python program sometime and compare the ratio of comment lines to code lines in comparison to software written by an adult in a compiled language.

But my real point is an answer to why people aren't using perl so much anymore; they grew up.

The new kids are using Python, PHP, Ruby, or whatever is the latest excuse not to actually compile code into something stable and maintainale.

Re:Perl has died in industry (mod away, kids) (0, Troll)

uassholes (1179143) | more than 5 years ago | (#29627907)

I constantly struggle to make various Python programs work.

Why can't people just write real programs in real languages?

Remember C and Java?

Re:Perl has died in industry. (3, Insightful)

Anonymous Coward | more than 5 years ago | (#29627427)

People just aren't using it for anything more than 10-line throwaway scripts.

You just posted on a website running Slash. Although it is Perl, so maybe the codebase is less than ten lines.

But we also expected we'd have that around 2005.

You were expecting it the same year the very first implementation (Pugs) was started? That was silly of you.

It's nearly 2010, and we still don't see much real progress on that front. Rakudo just isn't a production-grade product yet.

Unless lives are at risk, Rakudo is stable enough for production (although you may want to wait for the April "Rakudo Star" release).

I'm sad to admit it, but instead of waiting for incremental Perl 5 releases for the next decade until Perl 6 is finally mature enough

Perl 6 != Perl 5. They are two VERY different languages. Perl 5 and 6 will continue to be maintained in parallel.

until Perl 6 is finally mature enough, the company I'm with has started to migrate from Perl to Python.

You're complaining about maturity and yet you're using Python?

Unlike the Perl community, the Python community has shown with Python 3 that they're capable of working together to create a major release with many new features in a relatively short amount of time (especially compared to the Perl 6 effort).

Perl 6 has many, many more changes than Python 3. It is an entire rewrite of the language from the ground up, they didn't just change the print statement to a function and call it a day.

Rewriting our approximately 3 million lines of Perl code into Python has actually gone reasonably well.

That would have been what, 6 million lines in Python? Now I know you're trolling.

Re:Perl has died in industry. (-1)

Anonymous Coward | more than 5 years ago | (#29627679)

chromatic, is that you? Did you forget to log in?

Re:Perl has died in industry. (4, Interesting)

Fnord (1756) | more than 5 years ago | (#29627855)

Ok, I actually do use perl professionally, but even I realize there are some serious problems with it. The reality is a middle ground between you and the grandparent.

But we also expected we'd have that around 2005.

You were expecting it the same year the very first implementation (Pugs) was started? That was silly of you.

Pugs was started in 2005 as an attempt to inject life into what looked like a dying project. The language spec started in 2000. In five years they hadn't nailed it down. In ten years there still isn't a working implementation.

It's nearly 2010, and we still don't see much real progress on that front. Rakudo just isn't a production-grade product yet.

Unless lives are at risk, Rakudo is stable enough for production (although you may want to wait for the April "Rakudo Star" release).

That is EXTREMELY wishful thinking. It may have changed in the last couple months, but I tried this perl 6 code out earlier in the summer:

my $blah = "blah";
$blah = $blah.reverse;
print $blah;

and that SIMPLE code resulted in an infinite recursion error.

I'm sad to admit it, but instead of waiting for incremental Perl 5 releases for the next decade until Perl 6 is finally mature enough

Perl 6 != Perl 5. They are two VERY different languages. Perl 5 and 6 will continue to be maintained in parallel.

Perl 5 has problems inherent with the language that inhibit large scale use, and this is coming from someone who works on a multi-million line perl 5 project. Recent frameworks have tried to address the problems by grafting perl6 like features onto perl5, but they always impact performance, and are never perfect. And goddammit, I've still found no way around the broken behavior of the SUPER keyword.

until Perl 6 is finally mature enough, the company I'm with has started to migrate from Perl to Python.

You're complaining about maturity and yet you're using Python?

Unlike the Perl community, the Python community has shown with Python 3 that they're capable of working together to create a major release with many new features in a relatively short amount of time (especially compared to the Perl 6 effort).

Perl 6 has many, many more changes than Python 3. It is an entire rewrite of the language from the ground up, they didn't just change the print statement to a function and call it a day.

Rewriting our approximately 3 million lines of Perl code into Python has actually gone reasonably well.

That would have been what, 6 million lines in Python? Now I know you're trolling.

You're being a bit unfair to Python. I'm not a huge fan of the language (if I had to move anywhere it'd be ruby), but python 3 while it didn't change much in the language itself, was a huge boost in performance to the interpreter. There are incremental changes happening to the perl5 interpreter, but nothing major structural can, because the codebase just isn't very maintainable. In fact that was one of the main reasons they decided to scrap it and develop parrot from scratch instead of working from the perl5 base. Try embedding the python interpreter and the perl5 interpreter in a C program, see which one has internals that make more sense.

Not to mention that python is immensely more parsable. There are identical python interpreters in C, on the JVM, and on the CLR. Its been said that the only thing that can parse perl5 is perl5, and that is evidenced by the fact that the parrot project gave up on implementing a perl5 parser.

That's not to say there aren't things python does wrong. Every time there's a point release it seems everyone's code completely breaks, while perl5 is backward compatible to perl1. And frankly, I hate significant whitespace, but that's a personal preference.

Regardess things are not completely happy in the perl world.

Re:Perl has died in industry. (2, Informative)

Norsefire (1494323) | more than 5 years ago | (#29628039)

my $blah = "blah"; $blah = $blah.reverse; print $blah; and that SIMPLE code resulted in an infinite recursion error.

Might be because it's wrong? reverse is for lists.

$ perl6
> my $blah = 'blah'; $blah = $blah.flip; say $blah;
halb
> my @a = ; say @a.reverse;
dcba
>

Re:Perl has died in industry. (1)

Norsefire (1494323) | more than 5 years ago | (#29628061)

Oops, that line should have been:

my @a = <a b c d>; say @a.reverse;

Re:Perl has died in industry. (2, Insightful)

Fnord (1756) | more than 5 years ago | (#29628147)

I thought there was a reverse string function. In that case, why is it an infinite recursion and not a method not found?

Re:Perl has died in industry. (1)

A beautiful mind (821714) | more than 5 years ago | (#29628379)

Reverse string is .flip in P6.

Re:Perl has died in industry. (4, Insightful)

harmonise (1484057) | more than 5 years ago | (#29628851)

Perl 6 != Perl 5. They are two VERY different languages.

Then maybe they need to have two VERY different names. Have we learned nothing from the problems caused by Java and JavaScript? It's nearly 2010 and people still think those two languages have something in common with one another. Now we have two different languages with the same name. Did anyone think that that would not cause confusion?

who uses PERL (2, Informative)

viralMeme (1461143) | more than 5 years ago | (#29627499)

"For software of any appreciable size, Perl has unfortunately died in industry. People just aren't using it for anything more than 10-line throwaway scripts"

"Large and high profile [luv.asn.au] websites using Perl [perlfoundation.org] include: Slashdot, The Internet Movie Database, Amazon.com, CMPnet technical magazines ...

Re:who uses PERL (2, Interesting)

FooAtWFU (699187) | more than 5 years ago | (#29627977)

Also, the AirWave Management Platform [airwave.com] is in Perl (with C/XS/etc as appropriate in certain places). It sells for thousands-of to millions-of dollars, depending on your licensing and support needs. It's basically the only wireless network NMS out there which supports multiple brands of access point (Aruba, Cisco, HP/Colubris, Meru, Proxim, Symbol/Motorola, Foundry...) and its main competitor is basically Cisco WCS, which only manages/monitors Cisco devices.

Perl's take on object-oriented programming seems a little "fake" to some people: "what? you just bless hash references into a package named with a string? that's crazy!" But it works, and it works fairly well, and it is in fact very well-suited to development in this wildly heterogeneous environment.

Re:who uses PERL (0, Troll)

uassholes (1179143) | more than 5 years ago | (#29628045)

Is that why the interface is such fucking shit?

include: Slashdot

Re:who uses PERL (3, Informative)

onefriedrice (1171917) | more than 5 years ago | (#29628619)

Is that why the interface is such fucking shit?

include: Slashdot

I can't believe I have to explain this to somebody reading Slashdot, but interface is built with html and css, not perl (or any other server language).

Re:Perl has died in industry. (1)

Jurily (900488) | more than 5 years ago | (#29627577)

For software of any appreciable size, Perl has unfortunately died in industry. People just aren't using it for anything more than 10-line throwaway scripts.

Wasn't that the whole point of Perl? Perhaps we should be ashamed for doing large projects with it in the first place.

Re:Perl has died in industry. (1)

ThePhilips (752041) | more than 5 years ago | (#29627725)

For software of any appreciable size, Perl has unfortunately died in industry.

Industry doesn't end with "web design".

People just aren't using it for anything more than 10-line throwaway scripts.

Perl is one of those languages which grows on you. I had wrote year ago primitive forking HTTP servers with minimalistic CGI support. In the time it was 20 lines + 100 lines for the CGI scripts themselve. Now that is about 5K lines of code.

But in the end, yes, many 10-line Perl scripts become throwaway - when you realize how to do the job in 1 line.

Perl 6 was something those of us in industry had been anticipating with glee. We expected it to modernize the Perl platform, and make it a contender against Java, .NET and C++ for large-scale software development. But we also expected we'd have that around 2005. It's nearly 2010, and we still don't see much real progress on that front. Rakudo just isn't a production-grade product yet.

Change your dealer. He sells you something funny. Or get a real job.

I'm sad to admit it, but instead of waiting for incremental Perl 5 releases for the next decade until Perl 6 is finally mature enough, the company I'm with has started to migrate from Perl to Python. Unlike the Perl community, the Python community has shown with Python 3 that they're capable of working together to create a major release with many new features in a relatively short amount of time (especially compared to the Perl 6 effort).

If you were unable to exploit Perl 5 fully - it says more about you than about Perl itself.

Rewriting our approximately 3 million lines of Perl code into Python has actually gone reasonably well.

I would have wrote a Perl script for that ;)

Because such heavy lifting is what Perl best suited for.

Although I was a staunch defender of Perl, I do have to give Python its kudos. Every day it looks more and more like we've made the right choice moving away from Perl, and towards Python.

I'm surprised that it took you that long to find a language which suits you better.

Perl is simply not for everybody. And there is no language for everybody. It's a matter of what they call "taste" - or rather matter of your own abilities to exploit strengths of the tool.

It's not Perl's fault that it doesn't suit you.

Re:Perl has died in industry. (1)

Elwood P Dowd (16933) | more than 5 years ago | (#29628283)

People just aren't using it for anything more than 10-line throwaway scripts.

So when you say "in industry" you mean your industry, software development (not IT), and you mean dead for large projects (not dead).

Re:Perl has died in industry. (2, Informative)

schobes (750303) | more than 5 years ago | (#29628577)

Perl hasn't died. Cpan is one of the most active community and is the largest gathering of usable, open source code available on the net. Show anything that compares to this in the Python, Ruby, PHP realm and I'll shut up, but until you can provide me a CPAN replacement in another language why would you want to change languages.

Re:Perl has died in industry. (1)

greerga (2924) | more than 5 years ago | (#29628613)

For software of any appreciable size, Perl has unfortunately died in industry. People just aren't using it for anything more than 10-line throwaway scripts.

I'm in industry at my day job and rumors of its demise are greatly exaggerated.

Perl 6 was something those of us in industry had been anticipating with glee. We expected it to modernize the Perl platform, and make it a contender against Java, .NET and C++ for large-scale software development. But we also expected we'd have that around 2005. It's nearly 2010, and we still don't see much real progress on that front. Rakudo just isn't a production-grade product yet.

I'm sad to admit it, but instead of waiting for incremental Perl 5 releases for the next decade until Perl 6 is finally mature enough, the company I'm with has started to migrate from Perl to Python. Unlike the Perl community, the Python community has shown with Python 3 that they're capable of working together to create a major release with many new features in a relatively short amount of time (especially compared to the Perl 6 effort).

Rewriting our approximately 3 million lines of Perl code into Python has actually gone reasonably well. Although I was a staunch defender of Perl, I do have to give Python its kudos. Every day it looks more and more like we've made the right choice moving away from Perl, and towards Python.

Often times the effort of rewriting something is where you get your gains, regardless of which language you're doing it in (even the original). Learning from past mistakes, being more efficient, and adapting to new needs are all useful. You may have had the same gains from using PHP, depending on what you're liking.

Re:Perl has died in industry. (1)

greerga (2924) | more than 5 years ago | (#29628629)

and yes I messed up my quoting.

Great! Another language to learn! (0)

wandazulu (265281) | more than 5 years ago | (#29627377)

Specifically, I have to (re)learn Perl every time I write something in it, which has been about 2 dozen times over the past 12+ years. Seriously though, there's something about my mind that resists keeping any Perl syntax or tricks-n-tips longer than it takes to do the actual project; once it's done it's as if someone else wrote it.

Why is it I can keep *shudder* Excel 4 macro tricks and have them at the ready at all times (=while(not(isblank(active.cell)))...why do I still remember this?) but I still struggle to assign values to a simple array in Perl?

Re:Great! Another language to learn! (1)

vadim_t (324782) | more than 5 years ago | (#29627483)

Why is it I can keep *shudder* Excel 4 macro tricks and have them at the ready at all times (=while(not(isblank(active.cell)))...why do I still remember this?) but I still struggle to assign values to a simple array in Perl?

I have no clue? You assign values to an array in Perl in pretty much the same way as in any other language: $array[1] = $value;

Re:Great! Another language to learn! (1)

rubycodez (864176) | more than 5 years ago | (#29627535)

uh huh, then there's @array=qw(its whale guts) or @array=("its","whale","guts")

behold the whale guts!

Re:Great! Another language to learn! (5, Informative)

FooAtWFU (699187) | more than 5 years ago | (#29627831)

qw(the list of strings operator) is awesome and is equivalent to a list of strings. The main complication of Perl data types: If the thing you're assigning to, or getting out, is an array, it starts with an @: @states = ("Alabama", "Alaska", "Arizona", "Arkansas"); (or if you don't like typing ",s all day long, @states = qw(Alabama Alaska Arizona Arkansas). If the thing you're assigning to, or getting out, is a scalar, it starts with a $: $states[0] eq 'Alabama' or $states[0] = "Canada". If you want an array reference, the reference itself is a scalar, and the thing you're pulling out is also a scalar because that's all you can put into arrays (which is why complex data structures are arrays or hashes with references to other arrays or hashes inside). $stateref = \@states; $stateref->[0] eq 'Canada'; $other_ref = [qw(manitoba vancouver tiajuana)]; @array_again = @$stateref; @array_again = @{$other_ref}.

And that's really all there is to it, unless you want array slices or something (and who doesn't? @threestates = @states[0..3]).... or getting those out of a reference (@{$stateref}[0..3]).

Oh, and hashes work on the same principle, but with % for the hash, {} for the indexes, () for populating the hash with an even-sized list, {} for the anonymous reference, and you can do @a_codes = @state_to_postal_codes{qw(alabama alaska arizona arkanasas)}

Re:Great! Another language to learn! (1)

DieByWire (744043) | more than 5 years ago | (#29628117)

I love Perl, but I'll admit that after 6 months away I'm having to think a bit to get back into the all the reference/derefernce idioms.

So when the parent post explaining it all gets modded as funny... well, I hate to admit it, but that's kind of funny itself.

Re:Great! Another language to learn! (3, Insightful)

glassware (195317) | more than 5 years ago | (#29628389)

Every so often when I think that Perl might be worth considering again, I come across some truly baffling example of misguided intentions like this.

I'm sure someone thought it was a brilliant idea to save keystrokes - why type "list.GetRange(0,3)" when you can create syntax using random unused symbols on your keyboard like @states[0..3]? After all, the metric we use to judge programmer productivity is the number of keystrokes they use writing code, not the maintainability of their code.

Oh yeah! And let's pick a totally random set of characters and use it to tell the code syntax parser to change modes! How brilliant! We can just use "qw" to mean "list of strings operator". Sure, why not, nobody would ever write a function called qw on their own, so there will never be a conflict. And now our code has random text in it which is hard to scan for and isn't surrounded by quotes and doesn't obey the same logic that any other text does.

Seriously, consistency helps reduce the burden on a programmer. There is no excuse for a language that attempts to remove readability and consistency for the sake of reducing the number of keystrokes required to type a task. You can only save yourself typing time once, whereas readable code saves you time every day for years.

Re:Great! Another language to learn! (3, Insightful)

vadim_t (324782) | more than 5 years ago | (#29628667)

I'm sure someone thought it was a brilliant idea to save keystrokes - why type "list.GetRange(0,3)" when you can create syntax using random unused symbols on your keyboard like @states[0..3]? After all, the metric we use to judge programmer productivity is the number of keystrokes they use writing code, not the maintainability of their code.

What random symbols? the 0..3 type of syntax seems to be pretty common outside of Perl as well.

And Perl doesn't have a .GetRange(0,3) type syntax since it's not an OO language originally. OO was grafted on to it later, so a list in Perl is still a list, and not an object with methods.

Oh yeah! And let's pick a totally random set of characters and use it to tell the code syntax parser to change modes! How brilliant! We can just use "qw" to mean "list of strings operator". Sure, why not, nobody would ever write a function called qw on their own, so there will never be a conflict.

Same logic could apply to exactly any other function. Personally I think "print" is a much more logical name for a function a programmer might want to use than "qw" (if your code has functions with names like that, I don't want to deal with it).

As a language construct though, it'd be weird if "qw" had a much longer name, since it's intended to help make things shorter. And it probably stands for "quote words" which seems pretty logical given what it does.

Also, this complaint seems odd in regards to Perl, which has a much cleaner namespace than many other languages, and helps keeping it clean.

And now our code has random text in it which is hard to scan for and isn't surrounded by quotes and doesn't obey the same logic that any other text does.

I don't get this part?

Seriously, consistency helps reduce the burden on a programmer. There is no excuse for a language that attempts to remove readability and consistency for the sake of reducing the number of keystrokes required to type a task. You can only save yourself typing time once, whereas readable code saves you time every day for years.

I agree, though in part only.

Seriously, Perl gives you a choice. If you don't like it, don't use it. I don't use every single construct I can either. Sometimes they help:

my @months = qw( January February March April May June July August September October November December );

Why type all those quotes and commas, which can easily be messed up, leading to a compile failure? It's even more readable this way. Sometimes things like $_ help inside things like map, sometimes they make things more confusing. A good programmer knows when a tool is appropiate.

Sometimes quick and dirty is a good thing. When I make a log parser in 15 minutes to gather some stats for a one time event, it helps being able to take some shortcuts. But those are by no means necessary, and I don't use them when writing bigger things.

Re:Great! Another language to learn! (1)

FooAtWFU (699187) | more than 5 years ago | (#29628763)

why type "list.GetRange(0,3)" when you can create syntax using random unused symbols on your keyboard like @states[0..3]?

So you can also do @list[1,1,2,3,5,8,13,21,34] or @list[getFibonacci(0..8)] or any one of a number of things like that. So you can say

to_json(hash_slice_of($product, qw(name description serial_number price)))

.

Oh yeah! And let's pick a totally random set of characters and use it to tell the code syntax parser to change modes! How brilliant! We can just use "qw" to mean "list of strings operator".

Yes. Totally random, because no one will understand that 'qw' means 'quote words' (or that qq{foo} and qq(foo) is the same as "foo", or that q{foo} is 'foo', or qr{foo} is the regular expression /foo/, or that qx(foo) will execute the system command foo and return the output... No, no rhyme or reason to that setup at all! And no one will ever think to read it in a book or perldoc perlop.

You can only save yourself typing time once, whereas readable code saves you time every day for years.

Which is why (properly-executed) Perl is as awesome as it is. Look, I realize there are some trade-offs there, and that non-Perl parsing of Perl in particular is a nightmare, but between having the programming language type my quotes and commas, and having myself type the quotes and commas, I will pick the programming language 98% of the time. My IDE can handle it.

The point of a programming language is to make things easier for people with a modicum of basic skills, not the illiterate - otherwise we'd just use BASIC all the time. When it comes to Perl, you don't have trouble because there's something wrong with the language: you have trouble because you're ignorant and illiterate with regards to Perl. Stop blaming the language for your own deficiencies, and either learn the language or decide you have no need to and accept it as a personal limitation.

Re:Great! Another language to learn! (1)

vadim_t (324782) | more than 5 years ago | (#29627941)

qw and similar are there just to make assigning multiple values more comfortable. You can completely ignore its existence and not miss anything.

That leaves the '@array=("its","whale","guts")' form, which is also very similar to many other languages.

qw vs. explode or split (1)

tepples (727027) | more than 5 years ago | (#29628495)

qw and similar are there just to make assigning multiple values more comfortable. You can completely ignore its existence and not miss anything.

But what does Perl qw do that PHP explode() or Python str.split() doesn't?

$array = explode(' ', 'its whale guts'); # PHP

array = "its whale guts".split() # Python

Re:qw vs. explode or split (2, Informative)

vadim_t (324782) | more than 5 years ago | (#29628557)

Perl has that too.

@array = split(/ /, 'its whale guts');

With the additional advantage of that it uses a regular expression, so you can split by a much more complex criteria.

The difference is that qw happens at compile time, and split happens at runtime, so it has efficiency advantages. Additionally, qw lets you choose the delimiter. For instance:

@array1 = qw( its whale guts );
@array2 = qw/ its whale (guts) /;

Re:qw vs. explode or split (1)

tepples (727027) | more than 5 years ago | (#29628853)

The difference is that qw happens at compile time, and split happens at runtime, so it has efficiency advantages.

That's an implementation issue. A smart implementation of the language would apply what C calls the as if rule [sco.com] to methods of literal values. I don't know whether the Python bytecode compiler already does this.

Re:qw vs. explode or split (0)

Anonymous Coward | more than 5 years ago | (#29628615)

But what does Perl qw do that PHP explode() or Python str.split() doesn't?

Expresses the intention directly? qw means "create a list of strings"", whereas "...".split() means "make a string, then split it up into a list".

Re:qw vs. explode or split (0)

Anonymous Coward | more than 5 years ago | (#29628793)

It doesn't actually have to split a string, which can be considered a reasonably expensive operation.

Re:qw vs. explode or split (1)

tepples (727027) | more than 5 years ago | (#29628877)

It doesn't actually have to split a string, which can be considered a reasonably expensive operation.

The parser still has to split the string when compiling the program to bytecode.

netcraft didn't confirm but Perl is dying (-1, Troll)

rubycodez (864176) | more than 5 years ago | (#29627401)

Once the king of the scripting languages, too many better competitors with powerful features have sprung up, and we're still stuck with Perl 5 limitations. Perl 6 started in 2000, still not released and the 20-oughts decade is almost over. Way too many features thrown into that hodge-podge specification and overall way too complex. In short, with Perl 6 (should it ever really actually go out of pre-release status) the already crufty syntax of Perl 5 is going from "whale guts" to "its raining whales".

Larry is old enough we should start placing bets, does he die before Perl 6 comes out? does Perl die even before he does? Should Perl 6 be euthanized? should Larry? ok, just kidding with that last bit

Re:netcraft didn't confirm but Perl is dying (0, Insightful)

Anonymous Coward | more than 5 years ago | (#29627485)

What the fuck are you talking about? Perl is still the King of Scripting Languages and always will be, at least until it has some real competition.

Ruby is the biggest fucking joke to hit software development in years. It takes the worst of Smalltalk, and combines it with the worst of Perl. Then it adds in a bunch of smug college students, sorry, "rockstar programmers", who can only toss together ass-licking Web frameworks that pale in comparison to NeXT's early releases of WebObjects.

Python 3.0 has been a huge disaster. When we tried it at work, we found a huge number of problems with core modules. Many of them hadn't even been updated to support the Unicode string changes in Python 3.0! And a lot of the third-party Python software just plain won't work with Python 3.0. We couldn't fucking believe how horrible of an experience Python 3.0 was for us.

Perl is the only scripting language that is solid, is reliable, is flexible, runs just about everywhere, has an intelligent developer community, and just works out of the box. There is no alternative to Perl.

Re:netcraft didn't confirm but Perl is dying (0)

Anonymous Coward | more than 5 years ago | (#29627591)

Are you comparing Perl 5 to Python 3? Why not Python 2.6 or Perl 6?

Re:netcraft didn't confirm but Perl is dying (3, Insightful)

iggymanz (596061) | more than 5 years ago | (#29627677)

nice to hear of universe between your ears, where it's 1999. outside of that, in real world use, Perl has plummeted in use in last five years, from third most widely used language to eleventh. the language has stagnated and any Perl creative effort being wasted on the undead Perl 6.

Re:netcraft didn't confirm but Perl is dying (1, Informative)

Anonymous Coward | more than 5 years ago | (#29627851)

nice to hear of universe between your ears, where it's 1999. outside of that, in real world use, Perl has plummeted in use in last five years, from third most widely used language to eleventh. the language has stagnated and any Perl creative effort being wasted on the undead Perl 6.

Nice to hear of the universe between your ears, where it's a fantasy island that you created yourself. Perl is the 5th most popular [github.com] language on Github (and Ruby doesn't count because Engine Yard give Ruby guys free accounts). And Perl 5 and Perl 6 development are happening very separately, one of Rakudo's lead devs said a month or two ago that if they (personally) weren't working on Perl 6 they wouldn't be working on anything in the Perl community.

Re:netcraft didn't confirm but Perl is dying (3, Insightful)

Anonymous Coward | more than 5 years ago | (#29628103)

and Ruby doesn't count because Engine Yard give Ruby guys free accounts

Yeah, I'm gonna use this statistic, but only the part of it that I like.

Re:netcraft didn't confirm but Perl is dying (1)

iggymanz (596061) | more than 5 years ago | (#29628479)

hahaha, never heard of github until now? and the fifth most popular language of these gits means what exactly? bet Perl was their #1 a few years back if that site more than four years old

Re:netcraft didn't confirm but Perl is dying (2, Informative)

Anonymous Coward | more than 5 years ago | (#29628503)

Perl has plummeted in use in last five years

Really? [indeed.com] Or are you just making stuff up?

Re:netcraft didn't confirm but Perl is dying (2, Insightful)

ThePhilips (752041) | more than 5 years ago | (#29627747)

... we're still stuck with Perl 5 limitations.

Limitations in studio, please.

Larry is old enough we should start placing bets, does he die before Perl 6 comes out?

I'm accepting bets whether a card runs you over before you read the comment.

Re:netcraft didn't confirm but Perl is dying (2, Insightful)

Ant P. (974313) | more than 5 years ago | (#29627895)

too many better competitors with powerful features have sprung up

Such as... what? A Visual Basic clone (Python), a rewrite of VB itself (.Net), a Java ripoff (C#), something that brings a website to its knees before it hits 20 simultaneous users (Ruby), or an absolutely appalling clusterfuck of a language that can't even use consistent function names within a single module (its name shall not be spoken).

Re:netcraft didn't confirm but Perl is dying (0)

Anonymous Coward | more than 5 years ago | (#29628159)

Visual Basic DONE RIGHT (Python)

Re:netcraft didn't confirm but Perl is dying (0)

Anonymous Coward | more than 5 years ago | (#29628595)

You can polish a turd, but it's still a turd.

Re:netcraft didn't confirm but Perl is dying (0)

Anonymous Coward | more than 5 years ago | (#29628213)

I was writing a rebutal to your statements, but I came to the conclusion that it will be futile. So instead of that I just feel sorry for you, as I do for all Cobol programmers.

I have written some smaller Perl scripts and I will probably do so in the future. Perl is just unmatched when it comes to text processing. But for anything else the syntax is just to arcane. Instead of learning the Perl syntax in greater detail I prefer learning general concepts (or getting shit done).

Re:netcraft didn't confirm but Perl is dying (0)

Anonymous Coward | more than 5 years ago | (#29628309)

an absolutely appalling clusterfuck of a language that can't even use consistent function names within a single module (its name shall not be spoken).

I think its name should be spoken. I doubt that I'm the only one who doesn't know what language you're talking about.

Re:netcraft didn't confirm but Perl is dying (2, Funny)

tepples (727027) | more than 5 years ago | (#29628519)

an absolutely appalling clusterfuck of a language that can't even use consistent function names within a single module (its name shall not be spoken).

I think its name should be spoken. I doubt that I'm the only one who doesn't know what language you're talking about.

Let's just say that you might need a Physicians Health Plan after trying to remember whether or not a function name has an underscore.

Re:netcraft didn't confirm but Perl is dying (2, Informative)

jmlsteele (618769) | more than 5 years ago | (#29628609)

I believe he's talking about this [www.tnx.nl] .

Re:netcraft didn't confirm but Perl is dying (0)

Anonymous Coward | more than 5 years ago | (#29628449)

To be fair, Python is a lot more than a VB clone. I love Perl but you gotta give Python some respect.

Re:netcraft didn't confirm but Perl is dying (0, Flamebait)

smoker2 (750216) | more than 5 years ago | (#29627967)

Somehow I think your username gives away your bias. So STFU.

I love Perl (2)

kokoko1 (833247) | more than 5 years ago | (#29627441)

$Book = 'Perl For Dummies';
print 'The title is $Book.';
When you run the program, Perl displays

The title is $Book
.
Now change the single quotes to double quotes in the print statement:
$Book = 'Perl For Dummies';
print "The title is $Book.";
When you run the program now, Perl displays
The title is Perl For Dummies.

Re:I love Perl (1, Insightful)

Anonymous Coward | more than 5 years ago | (#29627503)

This is exactly how it should work. I'm not a fan of perl, but this is how most scripting languages, and your shell, do it. ' means literal quotation, while " is more relaxed.

Re:I love Perl (1)

ThePhilips (752041) | more than 5 years ago | (#29627779)

But there is more!

print qq{The title is $Book.\n}; # double quotes, not forgetting the \n

print q!The title is !.$Book.q!.\n!; # single quotes, not forgetting the \n

Quoting is the f***ing best feature in Perl. Ever.

Re:I love Perl (1)

TheLink (130905) | more than 5 years ago | (#29628815)

And there is yet even more:

#!/usr/bin/perl -wT
use strict;
sub bar {
  my $c=shift||'';
  return join(" ","Perl For Dummies", $c);
}
my $foo=<<"EOT";
Hey everyone, guess what...

The title of the book is "${\( bar(2))}".

Go figure.
EOT
print $foo;

Yes it's ugly that you can in effect interpolate functions in a huge blob of text. But it does save a lot of time compared to the printf or python way. You don't have to keep checking to see if the number of %s matches the number of things you want to interpolate, or that you've got stuff in the right order.

Or how about this:

#!/usr/bin/perl -wT
use strict;
sub foo {
  my $title=shift||'Unknown';
  my $startversion=shift||0;
  return sub {
      $startversion++;
      return $title unless ($startversion>1);
      return join(" ",$title,$startversion);
  }
}
my $bar=foo("Perl For Dummies");
my $bar2=foo("Perl Cookbook");
my $t=<<"EOT";
Hey everyone, guess what...

The title of the first book in library A is "${\( &$bar())}".
The title of the second one is "${\( &$bar())}".

The title of the first book in library B is: ${\( &$bar2())}.
The title of the second book in library B is: ${\( &$bar2())}.

Go figure.
EOT
print $t;

OK most of us won't need to use that sort of thing, but who knows, you might think of a reason to use stuff like that ;).

*cough* *cough* (1, Insightful)

CODiNE (27417) | more than 5 years ago | (#29627467)

...

unit tests.

Re:*cough* *cough* (2, Insightful)

Anonymous Coward | more than 5 years ago | (#29627673)

Unit tests are only as good as the programmer that programs them.

Many times, your solution is not cut and dry.

Re:*cough* *cough* (5, Informative)

A beautiful mind (821714) | more than 5 years ago | (#29627961)

Perl probably has the best testing culture out there from the major programming languages, including Java on the list. Between TAP [wikipedia.org] , Perl 5 core's large test suite and a myriad of test related modules [cpan.org] it has automated testing well covered.

Did you know for example that when you upload something to CPAN, it gets automatically smoked [cpantesters.org] on dozens of platforms and hundreds of different boxes, test reports sent to the author and assistance provided to diagnose platform specific problems if needed?

Manual testing is for the problems not caught by the huge array of automated tests.

Re:*cough* *cough* (0)

Anonymous Coward | more than 5 years ago | (#29628177)

Yup. And the TAP framework (Test::More) is super easy to link with requirement management frontends.

Changelog? (0)

Anonymous Coward | more than 5 years ago | (#29627573)

What's the point of a release announcement without a link to the changelog?

Comic books! Entertainment for little faggots. (-1, Troll)

Anonymous Coward | more than 5 years ago | (#29627647)

Let me give you a vision... You're in your early 20s, overweight, lazy, long greasy hair, hardcore gamer, living in mom's basement, you own a third rate katana, you wear a trench coat and some dollar store pentacle or Celtic necklace, big collection of Dungeons and Dragons shit, you tell people you're a Buddhist but have never read any of the buddhavacanas , you love Twilight, you hate work, you tell people you're geek but you've never had a single program work right, you hardly graduated public school and never even attempted college, like to talk science but you don't know the first thing about how anything works, you know even less about mathematics.

Yeah I know who you are, comic book fag. You're all the same.

P.S. Have a blast working second shift on a Friday night at the local Subway. You didn't have anything else going on anyway.

Re:Comic books! Entertainment for little faggots. (-1, Offtopic)

Anonymous Coward | more than 5 years ago | (#29627731)

WHARRGARBL

wharrgarbl!!!!!!!!!

WHARRGARBLWHARRGARBLwharrgarbl!!

Re:Comic books! Entertainment for little faggots. (0)

Anonymous Coward | more than 5 years ago | (#29628069)

Is that Perl?

Given that it probably is, what does it do? And is that also what it was supposed to do?

Perl -- Goodbye Old Friend (1)

tres (151637) | more than 5 years ago | (#29628129)

Perl was so. fricking. awesome. back when the only choices were shell scripts or compiled apps. It was such a leap forward. Who wouldn't be excited about Perl back in the '90s

But we're far beyond the sophistication of Perl. I'm not saying that you can't do some pretty fricking awesome things in Perl, but that Perl doesn't do many of the meta-tasks that we've come to expect in languages. These supporting features don't necessarily make things run or run fast, but rather help developers in the process of creation and maintenance. The industry has grown up and the black magic of hacking has been codified into the craft of coding.

And Perl isn't alone here, C++ is undergoing the same process.

Re:Perl -- Goodbye Old Friend (0)

Anonymous Coward | more than 5 years ago | (#29628663)

What meta-tasks are those? Not to diss you, just genuinely curious.

It would be better if it wasn't so huge (1, Interesting)

trparky (846769) | more than 5 years ago | (#29628263)

Perl would be a whole lot better if the damn interpreter wasn't so freakin' huge and didn't take almost fifty MBs of RAM to load. 50 MBs isn't that much to speak of unless you're not running MOD_PERL and you have several Perl scripts running at the same time and your poor server is brought to its knees.

Re:It would be better if it wasn't so huge (0)

Anonymous Coward | more than 5 years ago | (#29628383)

You must be doing something really fucking wrong if your Perl interpreter process is consuming that much RAM.

I just ran a 5000 line script that parses some C headers and generates C++ bindings. Running this Perl 5 script on Linux against my project with over 500 C header files, with it processing 20 header files in parallel, top is reporting that perl using 4 MB of virtual RAM, with 2.2 MB resident.

Something must be really fucked up with your script if it requires 50 MB of RAM.

Re:It would be better if it wasn't so huge (0)

Anonymous Coward | more than 5 years ago | (#29628401)

What?

Loading the naked interpreter on a 64bit linux machine (memory usage measured in bytes):

17748 perl-5.10.0
21544 bash-3.2.39
25596 python-2.5.2

Re:It would be better if it wasn't so huge (1)

A beautiful mind (821714) | more than 5 years ago | (#29628429)

50 MB is not the Perl interpreter size, but about 5MB for perl, 45 for loaded modules and the variables that come with them. You need to load a lof of moduels to get to 50MB. I'm not sure why are you worried about that 50MB though, most of it should be COW across the 20-40 child processes, or does that only work with FCGI like that?

Whats new? (1)

hey (83763) | more than 5 years ago | (#29628673)

Hey I still use and love perl!

Is there a list online of the cool new features?

Also, people dumping perl... what are you moving to?
(Thanks)

What about 3rd party modules? (0, Troll)

krypticmind (1369357) | more than 5 years ago | (#29628799)

Ladies, ladies, before you start talking about things you obviously lack the brains to comprehend, lets just remind everyone how one should measure an active development community. Lets examine the amount of modules in the default distribution for each of the top interpreted languages today: CPAN: 73018, PyPI: 7740, Pear: 132. A year ago, there were 58878 modules on CPAN (http://web.archive.org/web/20080730121430/http://search.cpan.org/). Draw your own conclusions whether the language is dead. Meanwhile, the Python (ex PHP retards) core team is still trying to figure out, 20 years deep in the development of the project, how to support UNICODE correctly. Good times!
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?