Skip to content

Instantly share code, notes, and snippets.

@edenc
Created March 29, 2013 02:10
Show Gist options
  • Select an option

  • Save edenc/5268276 to your computer and use it in GitHub Desktop.

Select an option

Save edenc/5268276 to your computer and use it in GitHub Desktop.
use warnings;
use strict;
$^I = '';
my %count;
my @chars = qw(B);
while(<>) {
for my $char (@chars) {
my @count = /($char)/g;
$count{$char} += @count;
s/$char//g;
}
print;
}
$^I = undef;
for my $char (@chars) {
print "$char: $count{$char}\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment