Here's what I use to strip comments. Note: it also
erases the shebang line.
#!/usr/bin/perl
use strict;
use warnings;
my $file = shift @ARGV;
open STDOUT, '>', '/root/Desktop/squish.log';
use PPI;
use Perl::Squish;
my $Document = PPI::Document->new($file);
$Document->prune( sub {
my $Braces = $_[1];
$Braces->isa('PPI::Structure::List') or return '';
$Braces->children == 0 or return '';
my $Method = $Braces->sprevious_sibling or return '';
$Method->isa('PPI::Token::Word') or return '';
$Method->content !~ /:/ or return '';
my $Operator = $Method->sprevious_sibling or return '';
$Operator->isa('PPI::Token::Operator') or return '';
$Operator->content eq '->' or return '';
return 1;
} );
my $Normal = $Document->normalized(2);
print $Document;