in reply to Rolling variable

In simple terms, you will have to capture the 8 most-recent observations in some sort of list, to which you will push the latest entries and then use (perldata array slices) to capture the most-recent ones. "How you persist those values" is entirely up to you.