tags:

views:

168

answers:

3

I have been hearing a lot about this "Modern Perl." Can anyone explain what it is?

One of the things I heard was the new open syntax:

open my $FH, '<', $filename

and not

open FH, "<$filename";

What else is in Modern Perl?

Thanks, Boda Cydo.

A: 

Modern perl isn't a proper noun, it's just something people might say to refer to perl code that uses features only available in the last X years, where X will vary from person to person.

For information about various changes to perl, see the perldelta files, for instance at http://perldoc.perl.org/index-history.html

ysth
(Yes, the book title and module name are proper nouns, but that's clearly not what was meant in the question.)
ysth
+5  A: 

To quote the source

Modern Perl programming, circa 2010, relies on the collected wisdom of the entire Perl ecosystem. It's time to write elegant, reliable, maintainable, well-tested, and predictable code.

See also, the book. And this quote from the book

Modern Perl is a loose description of how experienced and effective Perl 5 programers work. They use language idioms. They take advantage of the CPAN. They're recognizably Perlish, and they show good taste and craftsmanship and a full understanding of Perl.

deinst
+5  A: 

To add some specifics to deinst's overview, Modern Perl:

  • uses Perl 5.10's new features, like switch statements (given / when) and say
  • follows good Perl programming practices, like use strict and use warnings
  • may use the Modern::Perl CPAN module to streamline all of this
  • uses Moose for writing high-level OO code
Josh Kelley
Also: avoiding global variables, preferring lexical scoped ones and accessors, writing modular and reusable code, using CPAN, tests, tests and more tests!
szbalint
The `switch` you linked to is not a Perl 5.10 feature. It's a, now deprecated, core module. You might want be thinking of [`given`/`when`](http://perldoc.perl.org/perlsyn.html#Switch-statements)
Ven'Tatsu
@Ven'Tatsu: Fixed. Thanks for the correction.
Josh Kelley
Don't forget using Perl::Critic and PerlTidy to help maintain consistent style. Plus using some sort of version control software (git, subversion, etc).
daotoad