in reply to extract number of times a value appears in an array

Based on your expected result set it seems the order in which the entries appear is significant. Are the following two lists equivalent as input data?
my @array = (1,3,3,3,5,5,5,5); my @array = (1,3,3,5,5,5,5,3);