#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11111508 use warnings; open my $fh1, '<', \< ) { /([a-z][a-z_]*), (0x.),?$/ and $values{$1} = $2; } while( <$fh1> ) { s!([a-z][a-z_]*) = \K(\w+)(?=,$)! $values{$1} // $2 !e; print; }