Reputation: 4170
I'm working on migrating some legacy code, and Perl is having a fit on the following lines:
$message =~ s/_WIP_list{file}_/$WIP_list{$file}/g;
$message =~ s/_STD_list{file}_/$STD_list{$file}/g;
How should I be writing them to avoid the deprecation error?
Upvotes: 2
Views: 1166
Reputation: 62083
Escape the left brace with a backslash:
$message =~ s/_WIP_list\{file}_/$WIP_list{$file}/g;
$message =~ s/_STD_list\{file}_/$STD_list{$file}/g;
# ^
To help debug problems like this, you can add the following to get a more detailed explanation of the warning message:
use diagnostics;
Upvotes: 5