in reply to How to replace string in file2 that matches first column of file1 with second column of file1
As a general outline:
- Read file 1 line by line and chomp;
- Split on comma my ($last, $first) = split /,/;
- and store in hash: $name{$last} = $first;
- Read file 2 line by line
- Match against /uid=(?:.*),/, non-greedily
- Replace $1 with $name{$1} if it exists.