in reply to Replacing string with number

Another way, for fun:
$month=$months{$month}||$month;