http://www.perlmonks.org?node_id=1052586

Time and again I inherit code which does not use strict and warnings. One of the first things I do is turn on strict to see how much work lies ahead for me to make it strict. If I'm lucky, I just get a few complaints. More typically, however, I get screens full of output scrolling by. This will give you a short summary of the variables instead of the normal verbose strict output. For example:
$ strictv foo.pl $card : 3 $cardcounter : 2 $count : 2 $counter : 3 $i : 5 $number : 2 $suit : 2 $types : 2 @alreadyused : 2 @cards : 6 @iterations : 2 @suit : 2 foo.pl: 12 variables

It's also handy for code that people post on PerlMonks.

=head1 NAME B<strictv> - How (un)strict is your Perl code? =head1 SYNOPSIS strictv file ... =head1 DESCRIPTION Compile (but do not run) a Perl file using the C<strict> pragma. Only variables are checked. Input is a file (or several files). Output is to STDOUT. Example: strictv foo.pl =cut use warnings FATAL => 'all'; use strict; use List::Util qw(max); use English qw(-no_match_vars); for my $file (@ARGV) { $CHILD_ERROR = 0; my @errs = qx(perl -Mstrict=vars -c $file 2>&1); if ($CHILD_ERROR) { my %var; for (@errs) { if (/open perl script/) { print; } elsif (/ "([^"]+)" /x) { $var{$1}++; } } if (%var) { my $width = max(map {length} keys %var); for my $name (sort keys %var) { printf " %-${width}s : %d\n", $name, $var{$name}; } print "$file: ", scalar(keys %var), " variables\n"; } } }