in reply to Faster push and shift

I could imagine that the regex match is much slower than the push and shift. Use Devel::NYTProf to find out.

Also it is wrong to use $1 without checking if the regex succeeded.

(And no, I don't think there are much faster options. shift and push are appropriately optimized. But if you tell us how your input data looks like, and what output you want, maybe there is a faster option to achieve the same thing with a different algorithm).