例1:
#!/usr/bin/perl -w
my $fred ="yabba dabba doo";
my $where1 = rindex($fred,"abba");
print $where1;
my $where2 = rindex($fred,"abba",$where1 - 1);
print $where2;
例2:
#!/usr/bin/perl -w
my $long = "some very long string";
my $right = substr($long,index($long,"l"));
print $right;
阅读(878) | 评论(0) | 转发(0) |