in reply to Cannot get Perl to replace a specific string in my textfile

In the code you've shown, you don't need s/.../.../

$key = $replacements{$key};

The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: Cannot get Perl to replace a specific string in my textfile
by haukex (Archbishop) on Jan 13, 2017 at 15:56 UTC

    Hi 1nickt,

    In the code you've shown, you don't need s/.../.../

    $key = $replacements{$key};

    I'm not sure I'm understanding your post...? This doesn't work:

    foreach my $key ( sort keys %replacements ) { $key = $replacements{$key}; }

    Regards,
    -- Hauke D