my $in_pod=0; my $argcount = scalar @ARGV; while (<>) { # deals with uncorrect POD left open at the end # of the file if ($argcount > scalar @ARGV) { $in_pod=0; $argcount--; } if ($in_pod) { $in_pod = not /^=cut/; } else { $in_pod = /^=\w/; } next if $in_pod; # skip lines inside POD $mod{$1}++ if /use\s+([A-Za-z_:]+);/; }