Skip to content

Instantly share code, notes, and snippets.

@tomcha
Created July 20, 2013 13:16
Show Gist options
  • Save tomcha/6044974 to your computer and use it in GitHub Desktop.
Save tomcha/6044974 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Data::Dumper;
binmode STDIN,":encoding(UTF-8)";
binmode STDOUT,":utf8";
binmode STDERR,":utf8";
my $source_file = <STDIN>;
chomp($source_file);
my $fh;
my %variable_list;
open $fh,"<",$source_file or die $!;
my @entries = <$fh>;
close $fh;
for my $line(@entries){
if($line =~ /(\$[a-zA-Z]+[a-zA-Z0-9_]*)/){
$variable_list{$1}+=1;
}
}
print Dumper \%variable_list;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment