| | 29 | |
| | 30 | {{{ |
| | 31 | |
| | 32 | my $x = 23; |
| | 33 | { |
| | 34 | my $x = 42; |
| | 35 | { |
| | 36 | my $x = 19; |
| | 37 | print $x; # 19 |
| | 38 | } |
| | 39 | print $x; # 42 |
| | 40 | } |
| | 41 | |
| | 42 | print $x; # 23 |
| | 43 | }}} |
| | 44 | |
| | 45 | In the above code the programmer used the same variable name in several scopes. |
| | 46 | We would like to replace the one in the middle where $x is 42. We cannot replace it |
| | 47 | based on selection as that would rename the internal variables ($x = 19) as well. |
| | 48 | |
| | 49 | We can select one of the occurrences of $x that we want to replace, right-click on the mouse, |
| | 50 | select "Lexically Rename Variable", type in a new name and click OK. It will |
| | 51 | replace the correct variable (Once the bugs reported in #565 are fixed). |