1. $ where = index ($ big, $ small); the character position starts from 0. if the substring is found at the beginning of the string, index returns 0. if a character is followed, 1 is returned, and so on. if the substring does not exist,-1 is returned.
2. You can use the optional third parameter to request that it start to query from a later place. It will tell the index where it starts.
3. reverse search of rindex. The usage is the same as above.
4. $ part = substr ($ string, $ initial_position, $ length); a string, an initial position starting from 0 (similar to the return value of index), and the length of the substring. the returned value is a substring.
5. If you want to explicitly reach the end of a string, whether it is long or short, you can omit the third parameter.
6. The initial position can be negative, indicating starting from the end of the string (at this time,-1 indicates the last character)
7. The corresponding position selected in the string can be changed. If the string is a variable:
My $ string = "Hello, world !";
Substr ($ string, 0, 5) = "goodbye"; # $ string is now "Goodbye, world! "
8. in addition to assigning values to substr (the first time seems a little weird), you can also use a more traditional method to use susbtr: use four parameters, and the fourth parameter is the converted string. my $ previus_value = substr ($ string, 0, 5, "goodbye ");
9. the parameters of the sprintf function are exactly the same as those of printf (except for the optional file handle), but it returns the requested string instead of printed. this is very convenient for storing strings in a certain format into variables for future use, or you want to control the results more than the methods provided by printf.
10. <=> compare numbers, CMP compare strings!