while ($ts=~s/()(\d+)(<\/value><\/item>)/$1$paranum$3/si) { print "Set PNum: $paranum\n"; $paranum++; }