my $a="1234567895"; while ($a=~/5/g) { my $p=pos($a); print "$p\n"; } 转载于:https://www.cnblogs.com/yumtaoist/archive/2013/04/01/2994162.html