home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam

Programming Perl


3.2.128 rindex

rindex 

STR

, 

SUBSTR

, 

POSITION

rindex 

STR

, 

SUBSTR

This function works just like index except that it returns the position of the last occurrence of SUBSTR in STR (a reverse index ). The function returns $[-1 if not found. Since $[ is almost always 0 nowadays, the function almost always returns -1. POSITION , if specified, is the rightmost position that may be returned. To work your way through a string backward, say:

$pos = length $string;
while (($pos = rindex $string, $lookfor, $pos) >= 0) {
 print "Found at $pos\n";
 $pos--;
}

3.2.127 rewinddir Book Index 3.2.129 rmdir

[ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ]







(追記) (追記ここまで)


(追記) (追記ここまで)


AltStyle によって変換されたページ (->オリジナル) /