我在编写perl脚本时与Index和Rindex混淆.Perl中的Index和Rindex之间有什么区别(用简单的例子解释)
答案 0 :(得分:5)
perl -E 'say rindex("bar foo bar foo", "foo")'
^__ found first substring from right side
12
perl -E 'say index("bar foo bar foo", "foo")'
^__ found first substring from left side
4