I have a string: $string = "Hello [Alfred], how are you?"; print length($string); // result: 28

The result supposes to be 30, because [ and ] considered as 2 characters each as both [ and ] are the extended characters in GSM format. May I know is there any perl functions can count characters more efficiently? Or I should create my own function personally?

There are exactly 28 characters in the string. There is nothing special about the square brackets. Perhaps you expect the quotes to be part of the string. They are not. They are the syntax which tells perl that everything between them is a string.

If you really need any other interpratation, I suppose that you would have to write your own, but I strongly urge you to conform to perl conventions. Good Luck, Bill