index rindex

  substr:my $part = substr($string, $initial_position, $length);

                    //可为负数,最后-1。-2 -3...

  my $string = "Hello, world!";

  substr($string, 0, 5) = "Goodbye";  #string: "Goodbye, world!";

  ( my $previous_value = substr($string, 0, 5, "Goodbye"); )

 

 posted on 2012-09-10 20:55  飞翔@骑士  阅读(150)  评论(0编辑  收藏  举报