in reply to search and replace with serialized answers
perl -pe's/(?<=test)/ $state++ % 5 + 1 /e' [download]