http://qs321.pair.com?node_id=313964

It's actually somewhat robust...sort of. It could be shorter, but at the cost of an increase in clarity (in my opinion).
#!/usr/bin/perl -lp $?*=!$$?%,:$s;s.[g-z]|\W..gi;$;=(chomp,length);for(split//){s} (\w)}\U$1}gx;$_=+(ord)-55if(ord>$=);$?+=(16**--$;)*$_}s;$_;$?;
Brandan L.