Mar 20, 2013, 12:23 PM
Post #2 of 4
Your code does not work because the second back-tic is in the wrong place.
I would not recommend fixing it. Back-tics are used when you need the standard output. In this case, it is already redirected to a file. The function system would be a better choice.
Better yet, implement your editing in perl.
use vars qw(%SYNONYMS $SOURCE);
%SYNONYMS = (
old1 => 'new1',
old2 => 'new2',
old2 => 'new3',
my $source = join '|', keys %SYNONYMS;
$SOURCE = qr/$source/;
perl script.pl infile > outfile