index tells you the position of $s2 in $s1. length tells you the length of $s2, which you need for telling substr where to start the extraction.
With
etc., you get a description of these functions.perldoc -f index
In reply to Re: Perl Substr
by rovf
in thread Perl Substr
by lddzjwwy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |