One more little nit-pick: saying \d+|\w+ in a perl regex is sort of like saying "apples or fruit", because \w matches any alpha-numeric character or underscore. \w is equivalent to [0-9A-Za-z_] (though it'll actually match a lot more than that, if you feed it non-English text data in utf8 strings).
It's not nit-picking at all, I obviously overlooked that way back when I learned it and have been writing crap like that all this time. Thanx for catching that. ( I always wondered why everyone snickered at me so much when I handed them my code :)