in reply to Negating a leading whitespace
#!/usr/bin/perl -w use strict; my $test = "some random text with char X and char Y that I want ... X and Y Y ...\n"; my $occurs = ($test =~ tr/XY//); print "Your letters occurs ",$occurs," times\n";