| sub get_() {my $epr=shift; #传递进来的表达式my @a=(); my @b=(); my $b=0;push (@a,$b++) while (0<=($b=index ($epr,'(',$b)));push (@b,$b++) while (0<($b=index ($epr,')',$b)));if (@b==@a) {for(my $y=0;$y<=$#b;$y++) {for(my $x=$#a;$x>=0;$x--) {if ($b[$y]>$a[$x]) {print substr($epr,$a[$x]+1,$b[$y]-$a[$x]-1),"\n";splice (@a,$x,1);last ;}}}} else {print "括号不成对!\n";}} |