Convert human readable time interval to date components
Perl: 61 characters

Thanks to @nutki.

s/-?\d+ *m?(.)/$$1+=$&amp;/ge;$_="{y|o|d|h|i|s}";s/\w/${$&amp;}+0/ge


Sample run:

bash-4.3$ perl -pe 's/-?\d+ *m?(.)/$$1+=$&amp;/ge;$_="{y|o|d|h|i|s}";s/\w/${$&amp;}+0/ge' &lt;&lt;&lt; '1 year 2 months 3 seconds'
{1|2|0|0|0|3}

bash-4.3$ perl -pe 's/-?\d+ *m?(.)/$$1+=$&amp;/ge;$_="{y|o|d|h|i|s}";s/\w/${$&amp;}+0/ge' &lt;&lt;&lt; '-2 day 5 year 8months'
{5|8|-2|0|0|0}

bash-4.3$ perl -pe 's/-?\d+ *m?(.)/$$1+=$&amp;/ge;$_="{y|o|d|h|i|s}";s/\w/${$&amp;}+0/ge' &lt;&lt;&lt; '3day 9     years 4 seconds -5 minute 4 years 4 years -3seconds'
{17|0|3|0|-5|1}


My poor efforts: 78 77 characters

s/([+-]?\d+) *(..)/$a{$2}+=$1/ge;$_="{ye|mo|da|ho|mi|se}";s/\w./$a{$&amp;}||0/ge