It will examine your source file and list a series of warnings when it notices contructs that are different from the recommended practices.
Let me present you the Perl::Critic module, which allows the creation of a very simple script as described in the documentation.
use Modern::Perl;With this bit of code, you can check any Perl file for Policy violations within the program itself.
die "No file name as argument\n" if (@ARGV == 0);
my $file = $ARGV;
my $critic = Perl::Critic->new();
my @violations = $critic->critique($file);
If you name the above script critic.pl, you can also analyze external programs by typing "perl critic.pl AnyPerlFile.pl".
However, as Chris pointed out in the comments section (thanks!), there is a simpler way: use the perlcritic command line interface provided with the Perl::Critic module.
There are many available options to customize your analysis.
You can apply any policy that you would like. The default is the one described in Damian Conway's "Perl Best Practices" (PBP) book. A summary of all available policies on CPAN can be found here.
There is actually an even better way to use the Perl::Critic tool than the command line: the perlcritic website where you can jump directly to the offending lines in your code. You are also able to click on links taking you to the PBP's page related to the warning being displayed!
I find it a great way to learn good Perl programming tips with very little effort, as all the information is only one click away!
[Edit] For more in-depth information about Perl::Critic, take a look at this article from Perl Training Australia.
Larry Wall quote of the day:
"If someone stinks, view it as a reason to help them, not a reason to avoid them."