#!/usr/bin/env perl =head1 Name B - Sort perlcritic 'brutal' output by severity =head1 Description Input is a Perl script or module. Prints to STDOUT. Example: pcsort foo.pl =cut use warnings FATAL => 'all'; use strict; use Data::Dumper; my $file = shift; my @aoa; my @lines = `perlcritic -1 $file`; chomp @lines; for (@lines) { if (/ Severity : \s+ (\d) /x) { my $sev = $1; push @{ $aoa[$sev] }, $_; } } print Dumper(\@aoa);