my @input = split /\|/, $_; # we've split the input line into fields - the "|" are gone now my @output = @input; $output[1] = $lookup { $output[1] } // $output[1]; #map the second field print $out_fh join("|", @output); # put the "|" back in