in reply to Re^13: Immediately writing the results of search-and-replace
in thread Immediately writing the results of search-and-replace
$_ and ${_} are the same. You are free to enclose the name of any variable in curly brackets after its sigil. In this case they are required because the use is to append an m immediately after the $_ and if you were to write $_m then that would look for a scalar variable with name _m which doesn't exist. eg:
$ perl -wE 'say "$_m" for (1 .. 5)' Use of uninitialized value $_m in string at -e line 1. Use of uninitialized value $_m in string at -e line 1. Use of uninitialized value $_m in string at -e line 1. Use of uninitialized value $_m in string at -e line 1. Use of uninitialized value $_m in string at -e line 1. $ perl -wE 'say "${_}m" for (1 .. 5)' 1m 2m 3m 4m 5m $
HTH.
🦛
|
|---|