open (FILE, 'C:\Perl\bin\perlcc.bat') or die "Unable to open file: $!\n"; while () {chomp; $string .= $_;} $string =~ y/[A-Z]/[a-z]/; foreach $x(split //, $string) {if ($x =~ /[a-z]/){ $count{$x}++; }} foreach $key (sort keys %count){ print $key, '=', $count{$key}, "\n"; }