Created
March 29, 2013 02:10
-
-
Save edenc/5268276 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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