This is what I've basically done for now. There are some edge cases that this doesn't handle (I'll explain below). I'm sorta surprised that there is no perl module to do this already so maybe it's time I wrote one. I'd like to take this even further and be able to specify formats printf-like for the values.. It gets complicated quickly when I start thinking about fancy features...