Multiple choice technology programming languages

25 Which Perl function can be used to identify the first found occurrence of a substring?

  1. find

  2. index

  3. locate

  4. allocate

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In Perl, the index() function searches for a substring within a string and returns the position of the first occurrence (or -1 if not found). The find function does not exist in Perl, and locate/allocate are not string search functions.