karthik167 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I would like to do reclassification based on a 1:1 mapping. My Mapping table is as below (first row is header and next 2 rows is sample data. | is column separator; L2 is optional field) OldA|OldB|L1|L2 \n A|z|1| \n B|z|2|26 \n C|f|3|6 \n Request suggestion on what should be my xml schema to capture the above table info and how do I parse the xml such that when I pass OldA and OldB as input, the parser returns L1 and L2. Thanks, Karthik

Replies are listed 'Best First'.
Re: Reclassification based on XML map
by hdb (Monsignor) on May 14, 2014 at 12:01 UTC

    If I only look at your sample data, you could use a formula instead of a translation table:

    my $new = ord( uc $old ) - 64;

    For your more general question, I would suggest to translate your table into a hash of hashes and use XML::Simple to read and write the data.