- sub find_max_nest{
- my($arr_name)=@_;
- $nest_counter++;
- if($nest_counter>$max_nest){
- $max_nest=$nest_counter;
- }
- if($$arr_name[0] eq undef){
- $nest_counter--;
- }else{
- foreach $temp(@$arr_name){
- find_max_nest($temp);
- }
- $nest_counter--;
- }
- }
- #该片段来自于http://www.codesnippet.cn/detail/050120131318.html
来源: http://www.codesnippet.cn/detail/050120131318.html