Question 1: The Perl code 

printf("{") ;
while(<>) {
    if( $_ =~ /[^A-Z]*([A-Z])*[^A-Z]*([0-9A-F][0-9A-F])[^0-9A-F]*/ )
    {
        printf("{ '$1', 0x$2 },\n") ;
    }
}
printf("}\n") ;