The reason you are getting empty elements in @bytes is because there is nothing in between your delimiters (i.e. 01 and 02 are both delimiters and there is nothing between them). For a simpler example of this behavior, examine split(/x/, 'xxxxxxxxC') and split(/(x)/, 'xxxxxxxxC')