1

Perl value lookup and replace

view story
linux-howto

http://www.unix.com – Hi, I have an input file and a config file which I need to lookup values in using Perl: Input file: Code: ID, Value COMP0,0 COMP1,1 COMP2,2 COMP3,3 COMP4,3 COMP5,5 Config file: Code: ID, Operation COMP0,((@COMP1@ + @COMP2@ + @COMP3@) / @COMP4@) + @COMP5@ Expected output: Code: ID, Value COMP0,7 # This is ((1 + 2 + 3) / 3) + 5 COMP1,1 COMP2,2 COMP3,3 COMP4,3 COMP5,5 The config file contains two columns (comma separated). The first column contains the ID and the second column the operation. For each ID in the Input file, I need to check if it's in the config file, and if it's (HowTos)