How can I check whether a given string contains a certain substring, using Perl?
More specifically, I want to see whether s1.domain.example is present in the given string variable.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To find out if a string contains substring you can use the
indexfunction:It will return the position of the first occurrence of
$substrin$str, or -1 if the substring is not found.